From da1ebcf2d0879ba02cffae82eb4d12aee0f9cd4f Mon Sep 17 00:00:00 2001 From: PierreOlivierBrillant Date: Thu, 17 Oct 2024 14:01:20 -0400 Subject: [PATCH] Fixed shit --- scriptsharp/ScriptSharp/Program.cs | 5 ++--- scriptsharp/ScriptSharp/Utils/Utils.cs | 13 +++++++++++-- scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs | 1 - scriptsharp/ScriptSharp/Utils/UtilsFirebase.cs | 3 ++- scriptsharp/ScriptSharp/Utils/UtilsIntellij.cs | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/scriptsharp/ScriptSharp/Program.cs b/scriptsharp/ScriptSharp/Program.cs index ee76894..c67af51 100644 --- a/scriptsharp/ScriptSharp/Program.cs +++ b/scriptsharp/ScriptSharp/Program.cs @@ -49,10 +49,9 @@ static class Program private static async Task Main() { - UtilsFirebase.InstallFlutterFire(); - //LogSingleton.Get.LogAndWriteLine("yo"); - //TestDebug(); + Utils.CopyMachinePath(); Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); + //clear the log file LogSingleton.Get.LogAndWriteLine("Bienvenue dans l'installeur pour les cours de mobile"); LogSingleton.Get.LogAndWriteLine("ATTENTION DE BIEN ATTENDRE LA FIN DE L'INSTALLATION AVANT D'OUVRIR UN PROJET"); diff --git a/scriptsharp/ScriptSharp/Utils/Utils.cs b/scriptsharp/ScriptSharp/Utils/Utils.cs index 21aac08..643988a 100644 --- a/scriptsharp/ScriptSharp/Utils/Utils.cs +++ b/scriptsharp/ScriptSharp/Utils/Utils.cs @@ -415,7 +415,7 @@ public static async Task DownloadRepo(string url, string name) // download URL_3N5 to the Desktop and unzip it string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string zipFilePath = Path.Combine(desktopPath, name + ".zip"); - await Utils.DownloadFileAsync(url, zipFilePath); + await DownloadFileAsync(url, zipFilePath); LogSingleton.Get.LogAndWriteLine("Dézippage du repo " + zipFilePath + " vers " + desktopPath); ZipFile.ExtractToDirectory(zipFilePath, desktopPath, true); try { File.Delete(zipFilePath); } @@ -425,5 +425,14 @@ public static async Task DownloadRepo(string url, string name) } } - public static async Task DownloadRepoKmb() { await Utils.DownloadRepo(Config.UrlKmb, "KMB"); } + public static async Task DownloadRepoKmb() { await DownloadRepo(Config.UrlKmb, "KMB"); } + + public static void CopyMachinePath() + { + string[] machinePaths = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine)!.Split(";"); + string[] userPaths = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!.Split(";"); + string[] allPaths = machinePaths.Concat(userPaths).ToArray(); + string joinedPaths = string.Join(";", allPaths); + SetEnvVariable("Path", joinedPaths); + } } \ No newline at end of file diff --git a/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs b/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs index c0baf1d..79b5db3 100644 --- a/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs +++ b/scriptsharp/ScriptSharp/Utils/UtilsAndroidSdk.cs @@ -6,7 +6,6 @@ namespace ScriptSharp; public class UtilsAndroidSdk { - public static async Task InstallAndroidSdk() { LogSingleton.Get.LogAndWriteLine("Installation Android SDK démarré"); diff --git a/scriptsharp/ScriptSharp/Utils/UtilsFirebase.cs b/scriptsharp/ScriptSharp/Utils/UtilsFirebase.cs index e554d0b..ca1ee62 100644 --- a/scriptsharp/ScriptSharp/Utils/UtilsFirebase.cs +++ b/scriptsharp/ScriptSharp/Utils/UtilsFirebase.cs @@ -9,6 +9,7 @@ public static void InstallFirebase() } public static void InstallFlutterFire() { - Utils.RunCommand(UtilsFlutter.PathToDart()+" pub global activate flutterfire_cli"); + // Utils.RunCommand("echo %path%"); + Utils.RunCommand("dart pub global activate flutterfire_cli"); } } \ No newline at end of file diff --git a/scriptsharp/ScriptSharp/Utils/UtilsIntellij.cs b/scriptsharp/ScriptSharp/Utils/UtilsIntellij.cs index 7da7798..7e18f77 100644 --- a/scriptsharp/ScriptSharp/Utils/UtilsIntellij.cs +++ b/scriptsharp/ScriptSharp/Utils/UtilsIntellij.cs @@ -18,7 +18,7 @@ public static Task StartIntellij() { // start android studio LogSingleton.Get.LogAndWriteLine("Démarrage d'Intellij IDEA"); - string path = UtilsIntellij.PathToIntellij(); + string path = PathToIntellij(); Utils.CreateDesktopShortcut("Intellij", path); if (File.Exists(path)) {