diff options
Diffstat (limited to 'src/SMAPI.Installer')
-rw-r--r-- | src/SMAPI.Installer/InteractiveInstaller.cs | 4 | ||||
-rw-r--r-- | src/SMAPI.Installer/Program.cs | 2 | ||||
-rw-r--r-- | src/SMAPI.Installer/assets/unix-launcher.sh | 70 |
3 files changed, 30 insertions, 46 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 1457848b..dc96e2e8 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -468,7 +468,7 @@ namespace StardewModdingApi.Installer } // find target folder - ModFolder targetMod = targetMods.FirstOrDefault(p => p.Manifest?.UniqueID?.Equals(sourceMod.Manifest.UniqueID, StringComparison.InvariantCultureIgnoreCase) == true); + ModFolder targetMod = targetMods.FirstOrDefault(p => p.Manifest?.UniqueID?.Equals(sourceMod.Manifest.UniqueID, StringComparison.OrdinalIgnoreCase) == true); DirectoryInfo defaultTargetFolder = new DirectoryInfo(Path.Combine(paths.ModsPath, sourceMod.Directory.Name)); DirectoryInfo targetFolder = targetMod?.Directory ?? defaultTargetFolder; this.PrintDebug(targetFolder.FullName == defaultTargetFolder.FullName @@ -808,7 +808,7 @@ namespace StardewModdingApi.Installer continue; // should never happen // delete packaged mods (newer version bundled into SMAPI) - if (isDir && packagedModNames.Contains(entry.Name, StringComparer.InvariantCultureIgnoreCase)) + if (isDir && packagedModNames.Contains(entry.Name, StringComparer.OrdinalIgnoreCase)) { this.PrintDebug($" Deleting {entry.Name} because it's bundled into SMAPI..."); this.InteractivelyDelete(entry.FullName); diff --git a/src/SMAPI.Installer/Program.cs b/src/SMAPI.Installer/Program.cs index b7fa45f5..dc6c97f4 100644 --- a/src/SMAPI.Installer/Program.cs +++ b/src/SMAPI.Installer/Program.cs @@ -67,7 +67,7 @@ namespace StardewModdingApi.Installer AssemblyName name = new AssemblyName(e.Name); foreach (FileInfo dll in new DirectoryInfo(Program.InternalFilesPath).EnumerateFiles("*.dll")) { - if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.InvariantCultureIgnoreCase)) + if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.OrdinalIgnoreCase)) return Assembly.LoadFrom(dll.FullName); } return null; diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index b72eed22..1d97d487 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -46,80 +46,64 @@ else if [ "$ARCH" == "x86_64" ]; then ln -sf mcs.bin.x86_64 mcs cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64 - LAUNCHER="./StardewModdingAPI.bin.x86_64 $*" + LAUNCHER="./StardewModdingAPI.bin.x86_64" else ln -sf mcs.bin.x86 mcs cp StardewValley.bin.x86 StardewModdingAPI.bin.x86 - LAUNCHER="./StardewModdingAPI.bin.x86 $*" + LAUNCHER="./StardewModdingAPI.bin.x86" fi + export LAUNCHER # get cross-distro version of POSIX command COMMAND="" if command -v command 2>/dev/null; then COMMAND="command -v" elif type type 2>/dev/null; then - COMMAND="type" + COMMAND="type -p" fi # select terminal (prefer xterm for best compatibility, then known supported terminals) for terminal in xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty mate-terminal x-terminal-emulator; do if $COMMAND "$terminal" 2>/dev/null; then - # Find the true shell behind x-terminal-emulator - if [ "$(basename "$(readlink -f $(which "$terminal"))")" != "x-terminal-emulator" ]; then - export LAUNCHTERM=$terminal - break; - else - export LAUNCHTERM="$(basename "$(readlink -f $(which x-terminal-emulator))")" - # Remember that we're using x-terminal-emulator just in case it points outside the $PATH - export XTE=1 - break; - fi + export LAUNCHTERM=$terminal + break; fi done - # if no terminal was found, run in current shell or with no output - if [ -z "$LAUNCHTERM" ]; then - sh -c 'TERM=xterm $LAUNCHER' - if [ $? -eq 127 ]; then - $LAUNCHER --no-terminal - fi - exit + # find the true shell behind x-terminal-emulator + if [ "$LAUNCHTERM" = "x-terminal-emulator" ]; then + export LAUNCHTERM="$(basename "$(readlink -f $(COMMAND x-terminal-emulator))")" fi # run in selected terminal and account for quirks case $LAUNCHTERM in - terminator) - # Terminator converts -e to -x when used through x-terminal-emulator for some reason - if $XTE; then - terminator -e "sh -c 'TERM=xterm $LAUNCHER'" - else - terminator -x "sh -c 'TERM=xterm $LAUNCHER'" - fi + terminal|termite) + # LAUNCHTERM consumes only one argument after -e + # options containing space characters are unsupported + exec $LAUNCHTERM -e "env TERM=xterm $LAUNCHER $@" ;; - kitty) - # Kitty overrides the TERM varible unless you set it explicitly - kitty -o term=xterm $LAUNCHER + xterm|konsole|alacritty) + # LAUNCHTERM consumes all arguments after -e + exec $LAUNCHTERM -e env TERM=xterm $LAUNCHER "$@" ;; - alacritty) - # Alacritty doesn't like the double quotes or the variable - if [ "$ARCH" == "x86_64" ]; then - alacritty -e sh -c 'TERM=xterm ./StardewModdingAPI.bin.x86_64 $*' - else - alacritty -e sh -c 'TERM=xterm ./StardewModdingAPI.bin.x86 $*' - fi + terminator|xfce4-terminal|mate-terminal) + # LAUNCHTERM consumes all arguments after -x + exec $LAUNCHTERM -x env TERM=xterm $LAUNCHER "$@" ;; - xterm|xfce4-terminal|gnome-terminal|terminal|termite|mate-terminal) - $LAUNCHTERM -e "sh -c 'TERM=xterm $LAUNCHER'" + gnome-terminal) + # LAUNCHTERM consumes all arguments after -- + exec $LAUNCHTERM -- env TERM=xterm $LAUNCHER "$@" ;; - konsole) - konsole -p Environment=TERM=xterm -e "$LAUNCHER" + kitty) + # LAUNCHTERM consumes all trailing arguments + exec $LAUNCHTERM env TERM=xterm $LAUNCHER "$@" ;; *) # If we don't know the terminal, just try to run it in the current shell. - sh -c 'TERM=xterm $LAUNCHER' + env TERM=xterm $LAUNCHER "$@" # if THAT fails, launch with no output if [ $? -eq 127 ]; then - $LAUNCHER --no-terminal + exec $LAUNCHER --no-terminal "$@" fi esac fi |