From d561768246aac614946dd096226a38b4d9ede18b Mon Sep 17 00:00:00 2001 From: Jackson Law <178053+jlaw@users.noreply.github.com> Date: Mon, 22 Jun 2020 22:36:59 -0700 Subject: Update unix-launcher.sh $LAUNCHER does not evaluate when enclosed in single quotes. Changed to double quotes to run properly. --- src/SMAPI.Installer/assets/unix-launcher.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/SMAPI.Installer') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index b72eed22..b2f52c19 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -79,7 +79,7 @@ else # if no terminal was found, run in current shell or with no output if [ -z "$LAUNCHTERM" ]; then - sh -c 'TERM=xterm $LAUNCHER' + sh -c "TERM=xterm $LAUNCHER" if [ $? -eq 127 ]; then $LAUNCHER --no-terminal fi @@ -116,7 +116,7 @@ else ;; *) # If we don't know the terminal, just try to run it in the current shell. - sh -c 'TERM=xterm $LAUNCHER' + sh -c "TERM=xterm $LAUNCHER" # if THAT fails, launch with no output if [ $? -eq 127 ]; then $LAUNCHER --no-terminal -- cgit From 7900a84bd68d7c9450bba719ce925b61043875f3 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 26 Jul 2020 02:50:20 -0400 Subject: use ordinal comparison/sorting instead of invariant --- src/SMAPI.Installer/InteractiveInstaller.cs | 4 ++-- src/SMAPI.Installer/Program.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/SMAPI.Installer') 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; -- cgit From 1994eac81a819081d576aee78120dc089f9de9c0 Mon Sep 17 00:00:00 2001 From: Alena Messmer Date: Tue, 28 Jul 2020 21:41:06 -0700 Subject: avoid expanding arguments into quoted strings --- src/SMAPI.Installer/assets/unix-launcher.sh | 71 +++++++++++------------------ 1 file changed, 27 insertions(+), 44 deletions(-) (limited to 'src/SMAPI.Installer') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index b2f52c19..e6dc030a 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -46,80 +46,63 @@ 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 -- cgit From e96f4fb797c9544d525dbd414b034b0f545fc11b Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 29 Jul 2020 22:42:47 -0400 Subject: format new code, update release notes --- src/SMAPI.Installer/assets/unix-launcher.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/SMAPI.Installer') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index e6dc030a..1d97d487 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -69,9 +69,10 @@ else break; fi done - # Find the true shell behind x-terminal-emulator + + # find the true shell behind x-terminal-emulator if [ "$LAUNCHTERM" = "x-terminal-emulator" ]; then - export LAUNCHTERM="$(basename "$(readlink -f $(COMMAND x-terminal-emulator))")" + export LAUNCHTERM="$(basename "$(readlink -f $(COMMAND x-terminal-emulator))")" fi # run in selected terminal and account for quirks -- cgit