diff --git a/ArchiSteamFarm/IPC/Startup.cs b/ArchiSteamFarm/IPC/Startup.cs index 34bad9059..054be469c 100644 --- a/ArchiSteamFarm/IPC/Startup.cs +++ b/ArchiSteamFarm/IPC/Startup.cs @@ -106,6 +106,7 @@ internal sealed class Startup { if (PluginsCore.ActivePlugins?.Count > 0) { foreach (IWebInterface plugin in PluginsCore.ActivePlugins.OfType()) { if (string.IsNullOrEmpty(plugin.PhysicalPath) || string.IsNullOrEmpty(plugin.WebPath)) { + // Invalid path provided continue; } @@ -113,10 +114,18 @@ internal sealed class Startup { if (!Path.IsPathRooted(physicalPath)) { // Relative path - physicalPath = Path.Combine(Path.GetDirectoryName(plugin.GetType().Assembly.Location)!, plugin.PhysicalPath); + string? assemblyDirectory = Path.GetDirectoryName(plugin.GetType().Assembly.Location); + + if (string.IsNullOrEmpty(assemblyDirectory)) { + // Invalid path provided + continue; + } + + physicalPath = Path.Combine(assemblyDirectory, plugin.PhysicalPath); } if (!Directory.Exists(physicalPath)) { + // Non-existing path provided continue; } diff --git a/ArchiSteamFarm/Plugins/Interfaces/IWebInterface.cs b/ArchiSteamFarm/Plugins/Interfaces/IWebInterface.cs index a7592bee2..994289b57 100644 --- a/ArchiSteamFarm/Plugins/Interfaces/IWebInterface.cs +++ b/ArchiSteamFarm/Plugins/Interfaces/IWebInterface.cs @@ -25,13 +25,13 @@ namespace ArchiSteamFarm.Plugins.Interfaces; public interface IWebInterface : IPlugin { /// - /// Specifies physical path to static WWW files provided by the plugin. Can be either relative to plugin's assembly location, or absolute. Default "www" value assumes that you ship "www" directory together with your plugin's main DLL assembly, similar to ASF. + /// Specifies physical path to static WWW files provided by the plugin. Can be either relative to plugin's assembly location, or absolute. If you don't know better, we recommend value of "www", which assumes that you ship "www" directory together with your plugin's main DLL assembly, similar to ASF. /// - string PhysicalPath => "www"; + string PhysicalPath { get; } /// - /// Specifies web path (address) under which ASF should host your static WWW files in directory. Default "/" value allows you to override default ASF files and gives you full flexibility in your www directory. However, you can instead host your files under some fixed location specified here, such as "/MyPlugin". + /// Specifies web path (address) under which ASF should host your static WWW files in directory. If you don't know better, we recommend value of "/", which allows you to override default ASF files and gives you full flexibility in your directory. However, you can instead host your files under some other fixed location specified here, such as "/MyPlugin". /// [JsonProperty] - string WebPath => "/"; + string WebPath { get; } }