[fix] 修复Library/PlayerDataCache目录不存在时,PatchScriptingAssembliesJsonHook运行异常的bug

main
walon 2024-07-18 13:37:20 +08:00
parent 2d5f71f6b7
commit 9afbe3bd84
1 changed files with 18 additions and 14 deletions

View File

@ -35,7 +35,10 @@ namespace HybridCLR.MonoHook
private static string BuildMainWindowTitle() private static string BuildMainWindowTitle()
{ {
foreach (var tempJsonPath in Directory.GetDirectories($"{Application.dataPath}/../Library/PlayerDataCache", "*", SearchOption.TopDirectoryOnly)) var cacheDir = $"{Application.dataPath}/../Library/PlayerDataCache";
if (Directory.Exists(cacheDir))
{
foreach (var tempJsonPath in Directory.GetDirectories(cacheDir, "*", SearchOption.TopDirectoryOnly))
{ {
string dirName = Path.GetFileName(tempJsonPath); string dirName = Path.GetFileName(tempJsonPath);
#if UNITY_WEIXINMINIGAME #if UNITY_WEIXINMINIGAME
@ -55,6 +58,7 @@ namespace HybridCLR.MonoHook
var patcher = new PatchScriptingAssemblyList(); var patcher = new PatchScriptingAssemblyList();
patcher.PathScriptingAssembilesFile(tempJsonPath); patcher.PathScriptingAssembilesFile(tempJsonPath);
} }
}
string newTitle = BuildMainWindowTitleProxy(); string newTitle = BuildMainWindowTitleProxy();
return newTitle; return newTitle;