Skip to content

Commit

Permalink
Revert "Remove support for legacy devplugins directory (goatcorp#1219)…
Browse files Browse the repository at this point in the history
…" (goatcorp#1220)

This reverts commit 845a3fb.
  • Loading branch information
goaaats authored May 26, 2023
1 parent 845a3fb commit 681cda9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Dalamud.Injector/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ private static DalamudStartInfo ExtractAndInitializeStartInfoFromArguments(Dalam
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;
Expand All @@ -261,6 +262,8 @@ private static DalamudStartInfo ExtractAndInitializeStartInfoFromArguments(Dalam
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="))
Expand All @@ -284,6 +287,7 @@ private static DalamudStartInfo ExtractAndInitializeStartInfoFromArguments(Dalam
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;
Expand All @@ -309,6 +313,7 @@ private static DalamudStartInfo ExtractAndInitializeStartInfoFromArguments(Dalam
startInfo.WorkingDirectory = workingDirectory;
startInfo.ConfigurationPath = configurationPath;
startInfo.PluginDirectory = pluginDirectory;
startInfo.DefaultPluginDirectory = defaultPluginDirectory;
startInfo.AssetDirectory = assetDirectory;
startInfo.Language = clientLanguage;
startInfo.DelayInitializeMs = delayInitializeMs;
Expand Down Expand Up @@ -362,7 +367,7 @@ private static int ProcessHelpCommand(List<string> args, string? particularComma
}

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)]");

Expand Down
6 changes: 6 additions & 0 deletions Dalamud/DalamudStartInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public DalamudStartInfo(DalamudStartInfo other)
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;
Expand Down Expand Up @@ -71,6 +72,11 @@ public DalamudStartInfo(DalamudStartInfo other)
/// </summary>
public string? PluginDirectory { get; set; }

/// <summary>
/// Gets or sets the path to the directory for developer plugins.
/// </summary>
public string? DefaultPluginDirectory { get; set; }

/// <summary>
/// Gets or sets the path to core Dalamud assets.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override void Draw()
}
}

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);

Expand Down
27 changes: 25 additions & 2 deletions Dalamud/Plugin/Internal/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ internal partial class PluginManager : IDisposable, IServiceType
/// </summary>
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();
Expand All @@ -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
Expand Down Expand Up @@ -377,6 +394,9 @@ public async Task LoadAllPlugins()
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())
{
Expand Down Expand Up @@ -417,7 +437,7 @@ public async Task LoadAllPlugins()
}

// devPlugins are more freeform. Look for any dll and hope to get lucky.
var devDllFiles = new List<FileInfo>();
var devDllFiles = this.devPluginDirectory.GetFiles("*.dll", SearchOption.AllDirectories).ToList();

foreach (var setting in this.configuration.DevPluginLoadLocations)
{
Expand Down Expand Up @@ -640,8 +660,11 @@ public void RefilterPluginMasters(bool notify = true)
/// </summary>
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<FileInfo>();
var devDllFiles = this.devPluginDirectory.GetFiles("*.dll", SearchOption.AllDirectories).ToList();

foreach (var setting in this.configuration.DevPluginLoadLocations)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/FFXIVClientStructs
Submodule FFXIVClientStructs updated 1 files
+14 −14 ida/data.yml

0 comments on commit 681cda9

Please sign in to comment.