From b839b5018496d6a30e9fa28d933145db95d84834 Mon Sep 17 00:00:00 2001 From: PierreOlivierBrillant Date: Thu, 17 Oct 2024 12:45:07 -0400 Subject: [PATCH] Fix paths --- scriptsharp/ScriptSharp/Utils/Utils.cs | 13 ++++--------- scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs | 4 ++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/scriptsharp/ScriptSharp/Utils/Utils.cs b/scriptsharp/ScriptSharp/Utils/Utils.cs index 510e2c4..64a695f 100644 --- a/scriptsharp/ScriptSharp/Utils/Utils.cs +++ b/scriptsharp/ScriptSharp/Utils/Utils.cs @@ -289,13 +289,13 @@ public static void AddToPath(string binPath) string currentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User); if (currentPath == null) { - SetEnvironmentVariable("PATH", binPath); + SetEnvVariable("PATH", binPath); } else if (!currentPath.Contains(binPath)) { LogSingleton.Get.LogAndWriteLine("Ajout au Path de " + binPath); string updatedPath = currentPath + ";" + binPath; - SetEnvironmentVariable("PATH", updatedPath); + SetEnvVariable("PATH", updatedPath); } } @@ -311,7 +311,7 @@ private static void RemoveFromPath(string pattern) string[] filteredCurrentPathArray = currentPathArray.Where(path => !path.Contains(pattern)).ToArray(); string updatedPath = string.Join(";", filteredCurrentPathArray); - SetEnvironmentVariable("PATH", updatedPath); + SetEnvVariable("PATH", updatedPath); } public static void StartKmb() @@ -403,12 +403,7 @@ private static void DeleteThis(string path) } } } - public static void SetEnvironmentVariable(string variable, string value) - { - LogSingleton.Get.LogAndWriteLine("SetEnvironmentVariable démarré"); - Environment.SetEnvironmentVariable(variable, value, EnvironmentVariableTarget.User); - LogSingleton.Get.LogAndWriteLine("SetEnvironmentVariable arrêté"); - } + public static async Task DownloadRepo(string url, string name) { // download URL_3N5 to the Desktop and unzip it diff --git a/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs b/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs index ca55b85..c0baf1d 100644 --- a/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs +++ b/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs @@ -18,8 +18,8 @@ public static async Task InstallAndroidSdk() string sdkParentPath = Directory.GetParent(sdkPath)?.FullName; await Utils.Unzip7ZFileAsync(Path.Combine(Config.LocalTemp, "Sdk.7z"), sdkParentPath); // Add environment variables - Utils.SetEnvironmentVariable("ANDROID_SDK_ROOT", androidSdkRoot); - Utils.SetEnvironmentVariable("ANDROID_HOME", androidSdkRoot); + Utils.SetEnvVariable("ANDROID_SDK_ROOT", androidSdkRoot); + Utils.SetEnvVariable("ANDROID_HOME", androidSdkRoot); // Append to PATH