Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dalamudAsset cleanup to scan for all directories not current or dev #1355

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/XIVLauncher.Common/Dalamud/AssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo targ

Log.Verbose("[DASSET] Assets OK at {0}", assetsDir.FullName);

CleanUpOld(baseDir, info.Version - 1);
CleanUpOld(baseDir, info.Version);

return (assetsDir, info.Version);
}
Expand Down Expand Up @@ -225,16 +225,14 @@ private static void CleanUpOld(DirectoryInfo baseDir, int version)
if (GameHelpers.CheckIsGameOpen())
return;

for (int i = version; i >= version - 30; i--)
foreach (DirectoryInfo toDelete in baseDir.GetDirectories())
{
var toDelete = Path.Combine(baseDir.FullName, i.ToString());

try
{
if (Directory.Exists(toDelete))
if (Directory.Exists(toDelete.FullName) && toDelete.Name != "dev" & toDelete.Name != version.ToString())
belthesar marked this conversation as resolved.
Show resolved Hide resolved
{
Directory.Delete(toDelete, true);
Log.Verbose("[DASSET] Cleaned out old v{Version}", i);
Directory.Delete(toDelete.FullName, true);
Log.Verbose("[DASSET] Cleaned out old v{Version}", toDelete.Name);
}
}
catch (Exception ex)
Expand Down