Skip to content

Commit

Permalink
Ignore GShade folders on integrity check and repair (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiichi001 authored Jul 26, 2022
1 parent fca2ac2 commit 655885a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/XIVLauncher.Common/Game/IntegrityCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System.Security.Cryptography;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Serilog;
using XIVLauncher.Common.Util;

namespace XIVLauncher.Common.Game
{
Expand Down Expand Up @@ -87,6 +89,9 @@ private static IntegrityCheckResult DownloadIntegrityCheckForVersion(string game
public static async Task<IntegrityCheckResult> RunIntegrityCheckAsync(DirectoryInfo gamePath,
IProgress<IntegrityCheckProgress> progress, bool onlyIndex = false)
{
#if DEBUG
Log.Debug($"Platform identified as {PlatformHelpers.GetPlatform()}");
#endif
var hashes = new Dictionary<string, string>();

using (var sha1 = new SHA1Managed())
Expand All @@ -108,6 +113,14 @@ private static void CheckDirectory(DirectoryInfo directory, SHA1Managed sha1, st
{
var relativePath = file.FullName.Substring(rootDirectory.Length);


#if DEBUG
Log.Debug($"{relativePath} swapping to {relativePath.Replace("/", "\\")}");
#endif
// for unix compatibility with windows-generated integrity files.
relativePath = relativePath.Replace("/", "\\");


if (!relativePath.StartsWith("\\"))
relativePath = "\\" + relativePath;

Expand Down Expand Up @@ -139,7 +152,10 @@ private static void CheckDirectory(DirectoryInfo directory, SHA1Managed sha1, st
}

foreach (var dir in directory.GetDirectories())
CheckDirectory(dir, sha1, rootDirectory, ref results, progress, onlyIndex);
{
if (!dir.FullName.ToLower().Contains("shade")) //skip gshade directories. They just waste cpu
CheckDirectory(dir, sha1, rootDirectory, ref results, progress, onlyIndex);
}
}
}
}
3 changes: 3 additions & 0 deletions src/XIVLauncher.Common/Game/Patch/PatchVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class PatchVerifier : IDisposable

// Repair recycle bin folder.
new Regex(@"^repair_recycler/.*$", RegexOptions.IgnoreCase),

// Ignore gshade folders. Unless someone wants to handle the symlinked folder, just skip recycling them.
new Regex(@"^gshade-(shader|preset)s$", RegexOptions.IgnoreCase),
};

private readonly ISettings _settings;
Expand Down

0 comments on commit 655885a

Please sign in to comment.