diff --git a/scriptsharp/ScriptSharp/Program.cs b/scriptsharp/ScriptSharp/Program.cs index e63cddb..83b5861 100644 --- a/scriptsharp/ScriptSharp/Program.cs +++ b/scriptsharp/ScriptSharp/Program.cs @@ -239,6 +239,25 @@ static void SetEnvironmentVariable(string variable, string value) Utils.LogAndWriteLine("SetEnvironmentVariable arrĂȘtĂ©"); } + + public static string PathToAndroidStudio() + { + return Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.Desktop), + "android-studio", "bin", "studio64.exe"); + } + public static string PathToIntellij() + { + return Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.Desktop), + "idea", "bin", "idea64.exe"); + } + public static string PathToFlutter() + { + return Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.Desktop), + "flutter", "bin", "flutter"); + } } } \ No newline at end of file diff --git a/scriptsharp/ScriptSharp/Script5N6.cs b/scriptsharp/ScriptSharp/Script5N6.cs index 4d94d5f..1f7d1e2 100644 --- a/scriptsharp/ScriptSharp/Script5N6.cs +++ b/scriptsharp/ScriptSharp/Script5N6.cs @@ -36,9 +36,9 @@ await Task.WhenAll( Program.DownloadRepoKMB(), DownloadRepo5N6()); - Utils.RunCommand("studio64.exe installPlugins io.flutter"); - Utils.RunCommand("studio64.exe installPlugins com.github.copilot"); - Utils.RunCommand("studio64.exe installPlugins com.localizely.flutter-intl"); + Utils.RunCommand(Program.PathToAndroidStudio() + " installPlugins io.flutter"); + Utils.RunCommand(Program.PathToAndroidStudio() + " installPlugins com.github.copilot"); + Utils.RunCommand(Program.PathToAndroidStudio() + " installPlugins com.localizely.flutter-intl"); await InstallFlutter(); Utils.StartKMB(); await Utils.StartAndroidStudio(); @@ -59,14 +59,14 @@ await Utils.Unzip7zFileAsync( Path.Combine(Config.localTemp, "flutter.7z"), Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); // execute "flutter doctor --android-licenses" - Utils.RunCommand("flutter config --android-sdk "+Utils.GetSDKPath()); - Utils.RunCommand("flutter config --android-studio-dir "+Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "android-studio")); - Utils.RunCommand("flutter doctor --android-licenses"); - Utils.RunCommand("flutter doctor --verbose"); - Utils.RunCommand("flutter precache"); - Utils.RunCommand("flutter pub global activate devtools"); + Utils.RunCommand(Program.PathToFlutter() +" config --android-sdk "+Utils.GetSDKPath()); + Utils.RunCommand(Program.PathToFlutter() +" config --android-studio-dir "+Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "android-studio")); + Utils.RunCommand(Program.PathToFlutter() +" doctor --android-licenses"); + Utils.RunCommand(Program.PathToFlutter() +" doctor --verbose"); + Utils.RunCommand(Program.PathToFlutter() +" precache"); + Utils.RunCommand(Program.PathToFlutter() +" pub global activate devtools"); // create a fake project to initialize flutter - Utils.RunCommand("flutter create fake_start;cd fake_start;flutter run"); + Utils.RunCommand(Program.PathToFlutter() +" create fake_start;cd fake_start;flutter run"); Utils.LogAndWriteLine(" FAIT Installation Flutter complet"); } @@ -100,9 +100,9 @@ await Task.WhenAll( DownloadRepo5N6()); Utils.CreateDesktopShortcut("IntelliJ", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin", "idea64.exe")); Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); - Utils.RunCommand("studio64.exe installPlugins io.flutter"); - Utils.RunCommand("studio64.exe installPlugins com.github.copilot"); - Utils.RunCommand("studio64.exe installPlugins com.localizely.flutter-intl"); + Utils.RunCommand(Program.PathToAndroidStudio() + " installPlugins io.flutter"); + Utils.RunCommand(Program.PathToAndroidStudio() + " installPlugins com.github.copilot"); + Utils.RunCommand(Program.PathToAndroidStudio() + " installPlugins com.localizely.flutter-intl"); await InstallFlutter(); Utils.StartKMB(); Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData", diff --git a/scriptsharp/ScriptSharp/Utils.cs b/scriptsharp/ScriptSharp/Utils.cs index 6d42ad7..5cc92f5 100644 --- a/scriptsharp/ScriptSharp/Utils.cs +++ b/scriptsharp/ScriptSharp/Utils.cs @@ -325,12 +325,10 @@ public static async Task StartAndroidStudio() { // start android studio LogAndWriteLine("Lancement d'Android Studio"); - // Path to Android Studio executable is Desktop/android-studio/bin/studio64.exe - string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); - string androidStudioPath = Path.Combine(desktopPath, "android-studio","bin","studio64.exe"); + string androidStudioPath = Program.PathToAndroidStudio(); if (File.Exists(androidStudioPath)) { - CreateDesktopShortcut("Android-Studio", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "android-studio", "bin", "studio64.exe")); + CreateDesktopShortcut("Android-Studio", Program.PathToAndroidStudio()); ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = androidStudioPath, @@ -364,7 +362,7 @@ public static void AddToPath(string binPath) public static void StartKMB() { - RunCommand("idea64.exe " + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "KickMyB-Server-main")); + RunCommand(Program.PathToIntellij()+ " " + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "KickMyB-Server-main")); }