Skip to content

Commit

Permalink
Chemin absolus pour contourner le f***** path
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisdeguet committed Oct 16, 2024
1 parent 0730f53 commit 953e14f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
19 changes: 19 additions & 0 deletions scriptsharp/ScriptSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
26 changes: 13 additions & 13 deletions scriptsharp/ScriptSharp/Script5N6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
}

Expand Down Expand Up @@ -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",
Expand Down
8 changes: 3 additions & 5 deletions scriptsharp/ScriptSharp/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"));
}


Expand Down

0 comments on commit 953e14f

Please sign in to comment.