[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,25 +35,29 @@ namespace HybridCLR.MonoHook
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))
{
string dirName = Path.GetFileName(tempJsonPath);
#if UNITY_WEIXINMINIGAME
Debug.Assert(EditorUserBuildSettings.activeBuildTarget == BuildTarget.WeixinMiniGame);
if (!dirName.Contains("WeixinMiniGame"))
foreach (var tempJsonPath in Directory.GetDirectories(cacheDir, "*", SearchOption.TopDirectoryOnly))
{
continue;
}
string dirName = Path.GetFileName(tempJsonPath);
#if UNITY_WEIXINMINIGAME
Debug.Assert(EditorUserBuildSettings.activeBuildTarget == BuildTarget.WeixinMiniGame);
if (!dirName.Contains("WeixinMiniGame"))
{
continue;
}
#else
Debug.Assert(EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebGL);
if (!dirName.Contains("WebGL"))
{
continue;
}
Debug.Assert(EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebGL);
if (!dirName.Contains("WebGL"))
{
continue;
}
#endif
var patcher = new PatchScriptingAssemblyList();
patcher.PathScriptingAssembilesFile(tempJsonPath);
var patcher = new PatchScriptingAssemblyList();
patcher.PathScriptingAssembilesFile(tempJsonPath);
}
}
string newTitle = BuildMainWindowTitleProxy();