summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-07-28 21:28:41 -0400
committerGitHub <noreply@github.com>2022-07-28 21:28:41 -0400
commit5371dc3fce9b05075346414f6ee4de1230c90c22 (patch)
tree6ad583893c5ac9d4598a9c036c85638fcc216d7e
parent1095ce668284fe7a25556944054e5714cf164b4c (diff)
parentdd2e3e9d933c69aba2a11815191046903c7fa5ee (diff)
downloadSMAPI-5371dc3fce9b05075346414f6ee4de1230c90c22.tar.gz
SMAPI-5371dc3fce9b05075346414f6ee4de1230c90c22.tar.bz2
SMAPI-5371dc3fce9b05075346414f6ee4de1230c90c22.zip
Merge pull request #865 from ishanjalan/unix-launcher-changes
Apply suggested fixes from Rider in Unix launcher * [error] Argument mixes string and array. Use * or separate argument. * [warn] Declare and assign separately to avoid masking return values. * [warn] Quote to prevent word splitting. * [hint] echo may not expand escape sequences. Use printf. * [hint] read without -r will mangle backslashes. * [hint] Double quote to prevent globbing and word splitting.
-rw-r--r--src/SMAPI.Installer/assets/unix-launcher.sh24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh
index b9d468a0..88a3a328 100644
--- a/src/SMAPI.Installer/assets/unix-launcher.sh
+++ b/src/SMAPI.Installer/assets/unix-launcher.sh
@@ -55,7 +55,7 @@ if [ "$(uname)" == "Darwin" ]; then
if [ "$USE_CURRENT_SHELL" == "false" ]; then
echo "Reopening in the Terminal app..."
echo '#!/bin/sh' > /tmp/open-smapi-terminal.command
- echo "\"$0\" $@ --use-current-shell" >> /tmp/open-smapi-terminal.command
+ echo "\"$0\" $* --use-current-shell" >> /tmp/open-smapi-terminal.command
chmod +x /tmp/open-smapi-terminal.command
cat /tmp/open-smapi-terminal.command
open -W /tmp/open-smapi-terminal.command
@@ -71,8 +71,8 @@ fi
##########
# script must be run from the game folder
if [ ! -f "Stardew Valley.dll" ]; then
- echo "Oops! SMAPI must be placed in the Stardew Valley game folder.\nSee instructions: https://stardewvalleywiki.com/Modding:Player_Guide";
- read
+ printf "Oops! SMAPI must be placed in the Stardew Valley game folder.\nSee instructions: https://stardewvalleywiki.com/Modding:Player_Guide";
+ read -r
exit 1
fi
@@ -102,37 +102,39 @@ else
# find the true shell behind x-terminal-emulator
if [ "$TERMINAL_NAME" = "x-terminal-emulator" ]; then
- export TERMINAL_NAME="$(basename "$(readlink -f $(command -v x-terminal-emulator))")"
+ TERMINAL_NAME="$(basename "$(readlink -f "$(command -v x-terminal-emulator)")")"
+ export TERMINAL_NAME
fi
# run in selected terminal and account for quirks
- export TERMINAL_PATH="$(command -v $TERMINAL_NAME)"
- if [ -x $TERMINAL_PATH ]; then
+ TERMINAL_PATH="$(command -v "$TERMINAL_NAME")"
+ export TERMINAL_PATH
+ if [ -x "$TERMINAL_PATH" ]; then
case $TERMINAL_NAME in
terminal|termite)
# consumes only one argument after -e
# options containing space characters are unsupported
- exec $TERMINAL_NAME -e "env TERM=xterm $LAUNCH_FILE $@"
+ exec "$TERMINAL_NAME" -e "env TERM=xterm $LAUNCH_FILE $*"
;;
xterm|konsole|alacritty)
# consumes all arguments after -e
- exec $TERMINAL_NAME -e env TERM=xterm $LAUNCH_FILE "$@"
+ exec "$TERMINAL_NAME" -e env TERM=xterm $LAUNCH_FILE "$*"
;;
terminator|xfce4-terminal|mate-terminal)
# consumes all arguments after -x
- exec $TERMINAL_NAME -x env TERM=xterm $LAUNCH_FILE "$@"
+ exec "$TERMINAL_NAME" -x env TERM=xterm $LAUNCH_FILE "$*"
;;
gnome-terminal)
# consumes all arguments after --
- exec $TERMINAL_NAME -- env TERM=xterm $LAUNCH_FILE "$@"
+ exec "$TERMINAL_NAME" -- env TERM=xterm $LAUNCH_FILE "$*"
;;
kitty)
# consumes all trailing arguments
- exec $TERMINAL_NAME env TERM=xterm $LAUNCH_FILE "$@"
+ exec "$TERMINAL_NAME" env TERM=xterm $LAUNCH_FILE "$*"
;;
*)