Skip to content

Commit

Permalink
Make Clear Plugins separate from Clear Dalamud
Browse files Browse the repository at this point in the history
  • Loading branch information
rankynbass committed Nov 11, 2023
1 parent 48ac1d9 commit e0afbd5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ public override void Draw()

ImGui.Separator();

ImGui.Text("\nReset settings to default.");
if (ImGui.Button("Clear Settings"))
{
Program.ClearSettings(true);
}

ImGui.Text("\nClear the Wine Prefix - delete the ~/.xlcore/wineprefix folder");
if (ImGui.Button("Clear Prefix"))
{
Expand All @@ -43,10 +37,16 @@ public override void Draw()
Program.ClearTools(true);
}

ImGui.Text("\nClear all the files and folders related to Dalamud. Your settings will not be touched,\nbut all your plugins will be uninstalled, including 3rd-party repos.");
ImGui.Text("\nClear all the files and folders related to Dalamud. This will not uninstall your plugins or their configurations.");
if (ImGui.Button("Clear Dalamud"))
{
Program.ClearPlugins(true);
Program.ClearDalamud(true);
}

ImGui.Text("\nClear the installedPlugins folder. This will uninstall your plugins, but will not remove their configurations.");
if (ImGui.Button("Clear Plugins"))
{
Program.ClearPlugins();
}

ImGui.Text("\nClear all the log files.");
Expand All @@ -55,6 +55,12 @@ public override void Draw()
Program.ClearLogs(true);
}

ImGui.Text("\nReset settings to default.");
if (ImGui.Button("Clear Settings"))
{
Program.ClearSettings(true);
}

ImGui.Text("\nDo all of the above.");
if (ImGui.Button("Clear Everything"))
{
Expand Down
1 change: 1 addition & 0 deletions src/XIVLauncher.Core/CoreEnvironmentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static class CoreEnvironmentSettings
public static bool IsUpgrade => CheckEnvBool("XL_SHOW_UPGRADE");
public static bool ClearSettings => CheckEnvBool("XL_CLEAR_SETTINGS");
public static bool ClearPrefix => CheckEnvBool("XL_CLEAR_PREFIX");
public static bool ClearDalamud => CheckEnvBool("XL_CLEAR_DALAMUD");
public static bool ClearPlugins => CheckEnvBool("XL_CLEAR_PLUGINS");
public static bool ClearTools => CheckEnvBool("XL_CLEAR_TOOLS");
public static bool ClearLogs => CheckEnvBool("XL_CLEAR_LOGS");
Expand Down
16 changes: 11 additions & 5 deletions src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ private static void Main(string[] args)
{
if (CoreEnvironmentSettings.ClearSettings) ClearSettings();
if (CoreEnvironmentSettings.ClearPrefix) ClearPrefix();
if (CoreEnvironmentSettings.ClearDalamud) ClearDalamud();
if (CoreEnvironmentSettings.ClearPlugins) ClearPlugins();
if (CoreEnvironmentSettings.ClearTools) ClearTools();
if (CoreEnvironmentSettings.ClearLogs) ClearLogs();
Expand Down Expand Up @@ -393,17 +394,14 @@ public static void ClearPrefix()
storage.GetFolder("wineprefix");
}

public static void ClearPlugins(bool tsbutton = false)
public static void ClearDalamud(bool tsbutton = false)
{
storage.GetFolder("dalamud").Delete(true);
storage.GetFolder("dalamudAssets").Delete(true);
storage.GetFolder("installedPlugins").Delete(true);
storage.GetFolder("runtime").Delete(true);
if (storage.GetFile("dalamudUI.ini").Exists) storage.GetFile("dalamudUI.ini").Delete();
if (storage.GetFile("dalamudConfig.json").Exists) storage.GetFile("dalamudConfig.json").Delete();
storage.GetFolder("dalamud");
storage.GetFolder("dalamudAssets");
storage.GetFolder("installedPlugins");
storage.GetFolder("runtime");
if (tsbutton)
{
Expand All @@ -416,6 +414,13 @@ public static void ClearPlugins(bool tsbutton = false)
}
}

public static void ClearPlugins()
{
storage.GetFolder("installedPlugins").Delete(true);
storage.GetFolder("installedPlugins");
if (storage.GetFile("dalamudConfig.json").Exists) storage.GetFile("dalamudConfig.json").Delete();
}

public static void ClearTools(bool tsbutton = false)
{
foreach (var winetool in Wine.Versions)
Expand Down Expand Up @@ -453,7 +458,8 @@ public static void ClearAll(bool tsbutton = false)
{
ClearSettings(tsbutton);
ClearPrefix();
ClearPlugins(tsbutton);
ClearDalamud(tsbutton);
ClearPlugins();
ClearTools(tsbutton);
ClearLogs(true);
}
Expand Down

0 comments on commit e0afbd5

Please sign in to comment.