From dc129bd4589c38789002d5d16c2d03ada7dd53cc Mon Sep 17 00:00:00 2001 From: LuDong Date: Mon, 2 Sep 2024 18:34:53 +0800 Subject: [PATCH] check path --- Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs b/Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs index 9582a83..9dbc99e 100644 --- a/Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs +++ b/Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs @@ -75,7 +75,7 @@ static bool Exec(string filename, string args) public static bool ValidateConfig() { string sdkPath = EditorPrefs.GetString("AndroidSdkRoot", ""); - if (string.IsNullOrEmpty(sdkPath)) { sdkPath = DEFAULT_SDK_PATH; } + if (string.IsNullOrEmpty(sdkPath) || !Directory.Exists(sdkPath)) { sdkPath = DEFAULT_SDK_PATH; } if (string.IsNullOrEmpty(sdkPath) || !Directory.Exists(sdkPath)) { Debug.LogError("sdk path is empty! please config via menu path:Edit/Preference->External tools."); @@ -83,7 +83,7 @@ public static bool ValidateConfig() } string jdkPath = EditorPrefs.GetString("JdkPath", ""); - if (string.IsNullOrEmpty(jdkPath)) { jdkPath = DEFAULT_JDK_PATH; } + if (string.IsNullOrEmpty(jdkPath) || !Directory.Exists(jdkPath)) { jdkPath = DEFAULT_JDK_PATH; } if (string.IsNullOrEmpty(jdkPath) || !Directory.Exists(jdkPath)) { Debug.LogError("jdk path is empty! please config via menu path:Edit/Preference->External tools."); @@ -92,7 +92,7 @@ public static bool ValidateConfig() string ndkPath = EditorPrefs.GetString("AndroidNdkRootR16b", ""); if (string.IsNullOrEmpty(ndkPath)) { ndkPath = EditorPrefs.GetString("AndroidNdkRoot", ""); } - if (string.IsNullOrEmpty(ndkPath)) { ndkPath = DEFAULT_NDK_PATH; } + if (string.IsNullOrEmpty(ndkPath) || !Directory.Exists(ndkPath)) { ndkPath = DEFAULT_NDK_PATH; } if (string.IsNullOrEmpty(ndkPath) || !Directory.Exists(ndkPath)) { Debug.LogError("ndk path is empty! please config via menu path:Edit/Preference->External tools."); @@ -162,7 +162,7 @@ public static bool ExportGradleProject() public static bool BuildIl2cppSoLib() { string jdkPath = EditorPrefs.GetString("JdkPath", ""); - if (string.IsNullOrEmpty(jdkPath)) { jdkPath = DEFAULT_JDK_PATH; } + if (string.IsNullOrEmpty(jdkPath) || !Directory.Exists(jdkPath)) { jdkPath = DEFAULT_JDK_PATH; } if (string.IsNullOrEmpty(jdkPath) || !Directory.Exists(jdkPath)) { Debug.LogError("jdk path is empty! please config via menu path:Edit/Preference->External tools."); @@ -308,7 +308,7 @@ public static bool GenerateBinPatches() public static bool GenerateBuildScripts() { string jdkPath = EditorPrefs.GetString("JdkPath", ""); - if (string.IsNullOrEmpty(jdkPath)) { jdkPath = DEFAULT_JDK_PATH; } + if (string.IsNullOrEmpty(jdkPath) || !Directory.Exists(jdkPath)) { jdkPath = DEFAULT_JDK_PATH; } if (string.IsNullOrEmpty(jdkPath) || !Directory.Exists(jdkPath)) { Debug.LogError("jdk path is empty! please config via menu path:Edit/Preference->External tools.");