From 1130840001af9154e0f1112789aa547cd8d02688 Mon Sep 17 00:00:00 2001 From: SZanko Date: Mon, 9 Dec 2024 15:06:03 +0100 Subject: [PATCH 1/3] Update shebang to use /usr/bin/env for portability Changed the shebang from `#!/usr/bin/bash` to `#!/usr/bin/env bash` to improve script portability across different environments where `bash` may not be located in `/usr/bin/`. This ensures compatibility on systems with alternative `bash` paths. Signed-off-by: SZanko --- Stardrop/Assets/Stardrop.sh | 2 +- Stardrop/Utilities/External/SMAPI.cs | 2 +- Stardrop/Views/MainWindow.axaml.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Stardrop/Assets/Stardrop.sh b/Stardrop/Assets/Stardrop.sh index 46548866..9e0bffb3 100644 --- a/Stardrop/Assets/Stardrop.sh +++ b/Stardrop/Assets/Stardrop.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/env bash chmod u+x ./Internal ./Internal diff --git a/Stardrop/Utilities/External/SMAPI.cs b/Stardrop/Utilities/External/SMAPI.cs index 37d49ef6..f48c32f7 100644 --- a/Stardrop/Utilities/External/SMAPI.cs +++ b/Stardrop/Utilities/External/SMAPI.cs @@ -37,7 +37,7 @@ public static ProcessStartInfo GetPrepareProcess(bool hideConsole) Program.helper.Log($"Starting SMAPI with the following arguments: {arguments}"); var processInfo = new ProcessStartInfo { - FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? smapiInfo.FullName : "/bin/bash", + FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? smapiInfo.FullName : "/bin/env bash", Arguments = arguments, WorkingDirectory = smapiInfo.DirectoryName, RedirectStandardOutput = false, diff --git a/Stardrop/Views/MainWindow.axaml.cs b/Stardrop/Views/MainWindow.axaml.cs index 5faebc03..18ff1ddd 100644 --- a/Stardrop/Views/MainWindow.axaml.cs +++ b/Stardrop/Views/MainWindow.axaml.cs @@ -1328,7 +1328,7 @@ private async Task HandleStardropUpdateCheck(bool manualCheck = false) string[] arguments = new string[] { $"chmod +x {scriptPath}", $"{scriptPath}" }; var processInfo = new ProcessStartInfo { - FileName = "/bin/bash", + FileName = "/bin/env bash", Arguments = $"-c \"{string.Join(" ; ", arguments)}\"", CreateNoWindow = true, UseShellExecute = false @@ -2442,7 +2442,7 @@ private void CreateDirectoryJunctions(List arguments) // Prepare the process var processInfo = new ProcessStartInfo { - FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd" : "/bin/bash", + FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd" : "/bin/env bash", Arguments = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"/C {string.Join(" & ", arguments)}" : $"-c \"{string.Join(" ; ", arguments)}\"", RedirectStandardOutput = true, RedirectStandardError = true, From 2e7e0bcd0c708b05730eaaea13c64343029dcdf2 Mon Sep 17 00:00:00 2001 From: SZanko Date: Mon, 9 Dec 2024 22:27:33 +0100 Subject: [PATCH 2/3] Change /bin/env bash to /usr/bin/env Signed-off-by: SZanko --- Stardrop/Assets/Stardrop.sh | 2 +- Stardrop/Utilities/External/SMAPI.cs | 2 +- Stardrop/Views/MainWindow.axaml.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Stardrop/Assets/Stardrop.sh b/Stardrop/Assets/Stardrop.sh index 9e0bffb3..57e7a54f 100644 --- a/Stardrop/Assets/Stardrop.sh +++ b/Stardrop/Assets/Stardrop.sh @@ -1,3 +1,3 @@ -#!/bin/env bash +#!/usr/bin/env bash chmod u+x ./Internal ./Internal diff --git a/Stardrop/Utilities/External/SMAPI.cs b/Stardrop/Utilities/External/SMAPI.cs index f48c32f7..5795245c 100644 --- a/Stardrop/Utilities/External/SMAPI.cs +++ b/Stardrop/Utilities/External/SMAPI.cs @@ -37,7 +37,7 @@ public static ProcessStartInfo GetPrepareProcess(bool hideConsole) Program.helper.Log($"Starting SMAPI with the following arguments: {arguments}"); var processInfo = new ProcessStartInfo { - FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? smapiInfo.FullName : "/bin/env bash", + FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? smapiInfo.FullName : "/usr/bin/env bash", Arguments = arguments, WorkingDirectory = smapiInfo.DirectoryName, RedirectStandardOutput = false, diff --git a/Stardrop/Views/MainWindow.axaml.cs b/Stardrop/Views/MainWindow.axaml.cs index 18ff1ddd..99e3e37f 100644 --- a/Stardrop/Views/MainWindow.axaml.cs +++ b/Stardrop/Views/MainWindow.axaml.cs @@ -1328,7 +1328,7 @@ private async Task HandleStardropUpdateCheck(bool manualCheck = false) string[] arguments = new string[] { $"chmod +x {scriptPath}", $"{scriptPath}" }; var processInfo = new ProcessStartInfo { - FileName = "/bin/env bash", + FileName = "/usr/bin/env bash", Arguments = $"-c \"{string.Join(" ; ", arguments)}\"", CreateNoWindow = true, UseShellExecute = false @@ -2442,7 +2442,7 @@ private void CreateDirectoryJunctions(List arguments) // Prepare the process var processInfo = new ProcessStartInfo { - FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd" : "/bin/env bash", + FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd" : "/usr/bin/env bash", Arguments = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"/C {string.Join(" & ", arguments)}" : $"-c \"{string.Join(" ; ", arguments)}\"", RedirectStandardOutput = true, RedirectStandardError = true, From 2e6572656bafe78b7768821d94c0317e746ac154 Mon Sep 17 00:00:00 2001 From: SZanko Date: Tue, 16 Sep 2025 22:41:13 +0100 Subject: [PATCH 3/3] Add bash as an argument to /usr/bin/env Signed-off-by: SZanko --- Stardrop/Utilities/External/SMAPI.cs | 6 +++--- Stardrop/Views/MainWindow.axaml.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Stardrop/Utilities/External/SMAPI.cs b/Stardrop/Utilities/External/SMAPI.cs index 5795245c..1ccde2f5 100644 --- a/Stardrop/Utilities/External/SMAPI.cs +++ b/Stardrop/Utilities/External/SMAPI.cs @@ -27,17 +27,17 @@ public static ProcessStartInfo GetPrepareProcess(bool hideConsole) var smapiInfo = new FileInfo(Pathing.GetSmapiPath()); if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) is true) { - arguments = $"-c \"SMAPI_MODS_PATH='{Pathing.GetSelectedModsFolderPath()}' '{Pathing.GetSmapiPath().Replace("StardewModdingAPI.dll", "StardewValley")}'\""; + arguments = $"bash -c \"SMAPI_MODS_PATH='{Pathing.GetSelectedModsFolderPath()}' '{Pathing.GetSmapiPath().Replace("StardewModdingAPI.dll", "StardewValley")}'\""; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) is true) { - arguments = $"-c \"'{Pathing.GetSmapiPath().Replace("StardewModdingAPI.dll", "StardewModdingAPI")}' --mods-path '{Pathing.GetSelectedModsFolderPath()}'\""; + arguments = $"bash -c \"'{Pathing.GetSmapiPath().Replace("StardewModdingAPI.dll", "StardewModdingAPI")}' --mods-path '{Pathing.GetSelectedModsFolderPath()}'\""; } Program.helper.Log($"Starting SMAPI with the following arguments: {arguments}"); var processInfo = new ProcessStartInfo { - FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? smapiInfo.FullName : "/usr/bin/env bash", + FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? smapiInfo.FullName : "/usr/bin/env", Arguments = arguments, WorkingDirectory = smapiInfo.DirectoryName, RedirectStandardOutput = false, diff --git a/Stardrop/Views/MainWindow.axaml.cs b/Stardrop/Views/MainWindow.axaml.cs index 99e3e37f..d8b31bc7 100644 --- a/Stardrop/Views/MainWindow.axaml.cs +++ b/Stardrop/Views/MainWindow.axaml.cs @@ -1328,8 +1328,8 @@ private async Task HandleStardropUpdateCheck(bool manualCheck = false) string[] arguments = new string[] { $"chmod +x {scriptPath}", $"{scriptPath}" }; var processInfo = new ProcessStartInfo { - FileName = "/usr/bin/env bash", - Arguments = $"-c \"{string.Join(" ; ", arguments)}\"", + FileName = "/usr/bin/env", + Arguments = $"bash -c \"{string.Join(" ; ", arguments)}\"", CreateNoWindow = true, UseShellExecute = false };