Skip to content

Commit

Permalink
Fix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreOlivierBrillant committed Oct 17, 2024
1 parent 21df5bd commit b839b50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions scriptsharp/ScriptSharp/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b839b50

Please sign in to comment.