Skip to content

Commit bc8e7fc

Browse files
authored
Merge pull request #230 from pontaoski/work/janb/additional-plugins-path
Add -additionalplugins flag
2 parents 621303a + 46ce463 commit bc8e7fc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

TerrariaServerAPI/TerrariaApi.Server/ServerApi.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace TerrariaApi.Server
1919
public static class ServerApi
2020
{
2121
public const string PluginsPath = "ServerPlugins";
22+
public static string? AdditionalPluginsPath { get; private set; } = null;
2223

2324
public static readonly Version ApiVersion = new Version(2, 1, 0, 0);
2425
private static Main game;
@@ -263,6 +264,9 @@ internal static void HandleCommandLine(string[] parms)
263264
case "-crashdir":
264265
CrashReporter.crashReportPath = arg.Value;
265266
break;
267+
case "-additionalplugins":
268+
AdditionalPluginsPath = arg.Value;
269+
break;
266270
}
267271
}
268272
}
@@ -306,6 +310,12 @@ internal static void LoadPlugins()
306310

307311
List<FileInfo> fileInfos = new DirectoryInfo(ServerPluginsDirectoryPath).GetFiles("*.dll").ToList();
308312
fileInfos.AddRange(new DirectoryInfo(ServerPluginsDirectoryPath).GetFiles("*.dll-plugin"));
313+
if (AdditionalPluginsPath is string additionalPath)
314+
{
315+
var di = new DirectoryInfo(Path.Combine(AppContext.BaseDirectory, additionalPath));
316+
fileInfos.AddRange(di.GetFiles("*.dll"));
317+
fileInfos.AddRange(di.GetFiles("*.dll-plugin"));
318+
}
309319

310320
Dictionary<TerrariaPlugin, Stopwatch> pluginInitWatches = new Dictionary<TerrariaPlugin, Stopwatch>();
311321
foreach (FileInfo fileInfo in fileInfos)

0 commit comments

Comments
 (0)