diff --git a/Dalamud.Injector/EntryPoint.cs b/Dalamud.Injector/EntryPoint.cs index f6601ab43..c29fada83 100644 --- a/Dalamud.Injector/EntryPoint.cs +++ b/Dalamud.Injector/EntryPoint.cs @@ -247,6 +247,7 @@ namespace Dalamud.Injector var workingDirectory = startInfo.WorkingDirectory; var configurationPath = startInfo.ConfigurationPath; var pluginDirectory = startInfo.PluginDirectory; + var defaultPluginDirectory = startInfo.DefaultPluginDirectory; var assetDirectory = startInfo.AssetDirectory; var delayInitializeMs = startInfo.DelayInitializeMs; var logName = startInfo.LogName; @@ -261,6 +262,8 @@ namespace Dalamud.Injector configurationPath = args[i][key.Length..]; else if (args[i].StartsWith(key = "--dalamud-plugin-directory=")) pluginDirectory = args[i][key.Length..]; + else if (args[i].StartsWith(key = "--dalamud-dev-plugin-directory=")) + defaultPluginDirectory = args[i][key.Length..]; else if (args[i].StartsWith(key = "--dalamud-asset-directory=")) assetDirectory = args[i][key.Length..]; else if (args[i].StartsWith(key = "--dalamud-delay-initialize=")) @@ -284,6 +287,7 @@ namespace Dalamud.Injector workingDirectory ??= Directory.GetCurrentDirectory(); configurationPath ??= Path.Combine(xivlauncherDir, "dalamudConfig.json"); pluginDirectory ??= Path.Combine(xivlauncherDir, "installedPlugins"); + defaultPluginDirectory ??= Path.Combine(xivlauncherDir, "devPlugins"); assetDirectory ??= Path.Combine(xivlauncherDir, "dalamudAssets", "dev"); ClientLanguage clientLanguage; @@ -309,6 +313,7 @@ namespace Dalamud.Injector startInfo.WorkingDirectory = workingDirectory; startInfo.ConfigurationPath = configurationPath; startInfo.PluginDirectory = pluginDirectory; + startInfo.DefaultPluginDirectory = defaultPluginDirectory; startInfo.AssetDirectory = assetDirectory; startInfo.Language = clientLanguage; startInfo.DelayInitializeMs = delayInitializeMs; @@ -362,7 +367,7 @@ namespace Dalamud.Injector } Console.WriteLine("Specifying dalamud start info: [--dalamud-working-directory=path] [--dalamud-configuration-path=path]"); - Console.WriteLine(" [--dalamud-plugin-directory=path]"); + Console.WriteLine(" [--dalamud-plugin-directory=path] [--dalamud-dev-plugin-directory=path]"); Console.WriteLine(" [--dalamud-asset-directory=path] [--dalamud-delay-initialize=0(ms)]"); Console.WriteLine(" [--dalamud-client-language=0-3|j(apanese)|e(nglish)|d|g(erman)|f(rench)]"); diff --git a/Dalamud/DalamudStartInfo.cs b/Dalamud/DalamudStartInfo.cs index 4c8e7566d..658934005 100644 --- a/Dalamud/DalamudStartInfo.cs +++ b/Dalamud/DalamudStartInfo.cs @@ -30,6 +30,7 @@ public record DalamudStartInfo : IServiceType this.ConfigurationPath = other.ConfigurationPath; this.LogName = other.LogName; this.PluginDirectory = other.PluginDirectory; + this.DefaultPluginDirectory = other.DefaultPluginDirectory; this.AssetDirectory = other.AssetDirectory; this.Language = other.Language; this.GameVersion = other.GameVersion; @@ -71,6 +72,11 @@ public record DalamudStartInfo : IServiceType /// public string? PluginDirectory { get; set; } + /// + /// Gets or sets the path to the directory for developer plugins. + /// + public string? DefaultPluginDirectory { get; set; } + /// /// Gets or sets the path to core Dalamud assets. /// diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs index 3e73454f3..4e69dcb1a 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs @@ -67,7 +67,7 @@ public class DevPluginsSettingsEntry : SettingsEntry } } - ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDevPluginLocationsHint", "Add dev plugin load locations.\nThese can be either the directory or DLL path.")); + ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDevPluginLocationsHint", "Add additional dev plugin load locations.\nThese can be either the directory or DLL path.")); ImGuiHelpers.ScaledDummy(5); diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 9df249dd7..301e6bb68 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -57,6 +57,15 @@ internal partial class PluginManager : IDisposable, IServiceType /// public const int PluginWaitBeforeFreeDefault = 1000; // upped from 500ms, seems more stable + private const string DevPluginsDisclaimerFilename = "DONT_USE_THIS_FOLDER.txt"; + + private const string DevPluginsDisclaimerText = @"Hey! +The devPlugins folder is deprecated and will be removed soon. Please don't use it anymore for plugin development. +Instead, open the Dalamud settings and add the path to your plugins build output folder as a dev plugin location. +Remove your devPlugin from this folder. + +Thanks and have fun!"; + private static readonly ModuleLog Log = new("PLUGINM"); private readonly object pluginListLock = new(); @@ -79,10 +88,18 @@ internal partial class PluginManager : IDisposable, IServiceType private PluginManager() { this.pluginDirectory = new DirectoryInfo(this.startInfo.PluginDirectory!); + this.devPluginDirectory = new DirectoryInfo(this.startInfo.DefaultPluginDirectory!); if (!this.pluginDirectory.Exists) this.pluginDirectory.Create(); + if (!this.devPluginDirectory.Exists) + this.devPluginDirectory.Create(); + + var disclaimerFileName = Path.Combine(this.devPluginDirectory.FullName, DevPluginsDisclaimerFilename); + if (!File.Exists(disclaimerFileName)) + File.WriteAllText(disclaimerFileName, DevPluginsDisclaimerText); + this.SafeMode = EnvironmentConfiguration.DalamudNoPlugins || this.configuration.PluginSafeMode || this.startInfo.NoLoadPlugins; try @@ -377,6 +394,9 @@ internal partial class PluginManager : IDisposable, IServiceType if (!this.pluginDirectory.Exists) this.pluginDirectory.Create(); + if (!this.devPluginDirectory.Exists) + this.devPluginDirectory.Create(); + // Add installed plugins. These are expected to be in a specific format so we can look for exactly that. foreach (var pluginDir in this.pluginDirectory.GetDirectories()) { @@ -417,7 +437,7 @@ internal partial class PluginManager : IDisposable, IServiceType } // devPlugins are more freeform. Look for any dll and hope to get lucky. - var devDllFiles = new List(); + var devDllFiles = this.devPluginDirectory.GetFiles("*.dll", SearchOption.AllDirectories).ToList(); foreach (var setting in this.configuration.DevPluginLoadLocations) { @@ -640,8 +660,11 @@ internal partial class PluginManager : IDisposable, IServiceType /// public void ScanDevPlugins() { + if (!this.devPluginDirectory.Exists) + this.devPluginDirectory.Create(); + // devPlugins are more freeform. Look for any dll and hope to get lucky. - var devDllFiles = new List(); + var devDllFiles = this.devPluginDirectory.GetFiles("*.dll", SearchOption.AllDirectories).ToList(); foreach (var setting in this.configuration.DevPluginLoadLocations) { diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 9a32b1565..010e878fe 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 9a32b1565eeb0b237a427c242d7f0a78d4afbcfd +Subproject commit 010e878febb631c8f3ff5ff90d656f318e35b1de