diff --git a/scriptsharp/ScriptSharp/Program.cs b/scriptsharp/ScriptSharp/Program.cs index a1e9fff..e05fb84 100644 --- a/scriptsharp/ScriptSharp/Program.cs +++ b/scriptsharp/ScriptSharp/Program.cs @@ -144,7 +144,7 @@ public static async Task DownloadRepo(string url, string name) await Utils.DownloadFileAsync(url, zipFilePath); Utils.LogAndWriteLine("Dézippage du repo " + zipFilePath + " vers " + desktopPath); ZipFile.ExtractToDirectory(zipFilePath, desktopPath, true); - File.Delete(zipFilePath); + try { File.Delete(zipFilePath); }catch { } } // TODO split copy and unzip to start other download while unzipping @@ -174,7 +174,6 @@ public static async Task InstallAndroidStudio() string destinationFolder = Path.Combine(desktopPath); await Utils.Unzip7zFileAsync(Path.Combine(Config.localTemp,"android-studio.7z"), destinationFolder); // TODO add shortcut - Utils.CreateDesktopShortcut("Android-Studio", Path.Combine(desktopPath, "android-studio", "bin", "studio64.exe")); Utils.AddToPath(Path.Combine(desktopPath, "android-studio", "bin")); Utils.LogAndWriteLine(" FAIT Installation Android Studio fini"); } diff --git a/scriptsharp/ScriptSharp/Script3N5.cs b/scriptsharp/ScriptSharp/Script3N5.cs index a5ff625..a86a38d 100644 --- a/scriptsharp/ScriptSharp/Script3N5.cs +++ b/scriptsharp/ScriptSharp/Script3N5.cs @@ -70,7 +70,6 @@ await Task.WhenAll( "idea") ), Program.InstallJava() ); - 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.LogAndWriteLine("Premier gradle build pour constituer le .gradle"); // install plugins TODO ? one day? diff --git a/scriptsharp/ScriptSharp/Script5N6.cs b/scriptsharp/ScriptSharp/Script5N6.cs index 158fe08..3f0719b 100644 --- a/scriptsharp/ScriptSharp/Script5N6.cs +++ b/scriptsharp/ScriptSharp/Script5N6.cs @@ -39,9 +39,9 @@ await Task.WhenAll( Utils.RunCommand("studio64.exe installPlugins io.flutter"); Utils.RunCommand("studio64.exe installPlugins com.github.copilot"); Utils.RunCommand("studio64.exe installPlugins com.localizely.flutter-intl"); - await Utils.StartAndroidStudio(); await InstallFlutter(); Utils.StartKMB(); + await Utils.StartAndroidStudio(); Utils.LogAndWriteLine(" FAIT 5N6 Flutter complet"); } @@ -102,13 +102,13 @@ await Task.WhenAll( Utils.RunCommand("studio64.exe installPlugins io.flutter"); Utils.RunCommand("studio64.exe installPlugins com.github.copilot"); Utils.RunCommand("studio64.exe installPlugins com.localizely.flutter-intl"); - await Utils.StartAndroidStudio(); await InstallFlutter(); Utils.StartKMB(); Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData", "Local", "Pub", "Cache", "bin")); Utils.RunCommand("npm install -g firebase-tools"); Utils.RunCommand("dart pub global activate flutterfire_cli"); + await Utils.StartAndroidStudio(); Utils.LogAndWriteLine(" FAIT 5N6 Flutter + firebase complet"); } diff --git a/scriptsharp/ScriptSharp/Utils.cs b/scriptsharp/ScriptSharp/Utils.cs index 97746b2..70f8b41 100644 --- a/scriptsharp/ScriptSharp/Utils.cs +++ b/scriptsharp/ScriptSharp/Utils.cs @@ -305,6 +305,7 @@ public static async Task StartIntellij() LogAndWriteLine("Démarrage d'Intellij IDEA"); string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string path = Path.Combine(desktopPath, "idea","bin","idea64.exe"); + CreateDesktopShortcut("Intellij", path); if (File.Exists(path)) { ProcessStartInfo processStartInfo = new ProcessStartInfo @@ -328,6 +329,7 @@ public static async Task StartAndroidStudio() string androidStudioPath = Path.Combine(desktopPath, "android-studio","bin","studio64.exe"); if (File.Exists(androidStudioPath)) { + CreateDesktopShortcut("Android-Studio", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "android-studio", "bin", "studio64.exe")); ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = androidStudioPath, @@ -381,6 +383,8 @@ public static void DeleteAll() DeleteThis(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); DeleteThis(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".android")); DeleteThis(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gradle")); + // quit the app + System.Environment.Exit(0); } private static void DeleteThis(string path) @@ -390,7 +394,7 @@ private static void DeleteThis(string path) { Directory.Delete(path, true); } } catch (Exception ex) - { LogAndWriteLine($"An error occurred while deleting the directory: {ex.Message}"); } + { Console.WriteLine($"An error occurred while deleting the directory {path}: {ex.Message} {ex.Data}"); } } }