diff options
| author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-08-20 17:01:59 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-08-20 17:01:59 -0400 |
| commit | a1bc96d365dc40275f198668d3f4c09bd7a92613 (patch) | |
| tree | 5a130399bf8031aa70defb71a121b740d7c6cd7a /src/SMAPI.Installer | |
| parent | d51ffe58f7b7450cd4c4a7ee3d8b4da1cf55e7e4 (diff) | |
| parent | f3a79219e85c9af18f2f6d8b2aaa794afa08578d (diff) | |
| download | SMAPI-a1bc96d365dc40275f198668d3f4c09bd7a92613.tar.gz SMAPI-a1bc96d365dc40275f198668d3f4c09bd7a92613.tar.bz2 SMAPI-a1bc96d365dc40275f198668d3f4c09bd7a92613.zip | |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Installer')
| -rw-r--r-- | src/SMAPI.Installer/InteractiveInstaller.cs | 12 | ||||
| -rw-r--r-- | src/SMAPI.Installer/assets/unix-launcher.sh | 34 |
2 files changed, 24 insertions, 22 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index fd1a6047..d00a5df4 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -206,7 +206,7 @@ namespace StardewModdingApi.Installer Console.WriteLine(); // handle choice - string choice = this.InteractivelyChoose("Type 1 or 2, then press enter.", new[] { "1", "2" }); + string choice = this.InteractivelyChoose("Type 1 or 2, then press enter.", new[] { "1", "2" }, printLine: Console.WriteLine); switch (choice) { case "1": @@ -629,22 +629,22 @@ namespace StardewModdingApi.Installer } /// <summary>Interactively ask the user to choose a value.</summary> - /// <param name="print">A callback which prints a message to the console.</param> + /// <param name="printLine">A callback which prints a message to the console.</param> /// <param name="message">The message to print.</param> /// <param name="options">The allowed options (not case sensitive).</param> /// <param name="indent">The indentation to prefix to output.</param> - private string InteractivelyChoose(string message, string[] options, string indent = "", Action<string>? print = null) + private string InteractivelyChoose(string message, string[] options, string indent = "", Action<string>? printLine = null) { - print ??= this.PrintInfo; + printLine ??= this.PrintInfo; while (true) { - print(indent + message); + printLine(indent + message); Console.Write(indent); string? input = Console.ReadLine()?.Trim().ToLowerInvariant(); if (input == null || !options.Contains(input)) { - print($"{indent}That's not a valid option."); + printLine($"{indent}That's not a valid option."); continue; } return input; diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index ae9624e7..778663d7 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -54,12 +54,12 @@ if [ "$(uname)" == "Darwin" ]; then # https://stackoverflow.com/a/29511052/262123 if [ "$USE_CURRENT_SHELL" == "false" ]; then echo "Reopening in the Terminal app..." - echo '#!/bin/sh' > /tmp/open-smapi-terminal.sh - echo "\"$0\" $@ --use-current-shell" >> /tmp/open-smapi-terminal.sh - chmod +x /tmp/open-smapi-terminal.sh - cat /tmp/open-smapi-terminal.sh - open -W -a Terminal /tmp/open-smapi-terminal.sh - rm /tmp/open-smapi-terminal.sh + echo '#!/bin/sh' > /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 + rm /tmp/open-smapi-terminal.command exit 0 fi fi @@ -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 "$@" ;; *) |
