summaryrefslogtreecommitdiff
path: root/src/SMAPI.Installer
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-11-24 13:49:30 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-11-24 13:49:30 -0500
commita3f21685049cabf2d824c8060dc0b1de47e9449e (patch)
treead9add30e9da2a50e0ea0245f1546b7378f0d282 /src/SMAPI.Installer
parent6521df7b131924835eb797251c1e956fae0d6e13 (diff)
parent277bf082675b98b95bf6184fe3c7a45b969c7ac2 (diff)
downloadSMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.tar.gz
SMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.tar.bz2
SMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Installer')
-rw-r--r--src/SMAPI.Installer/Framework/InstallerPaths.cs2
-rw-r--r--src/SMAPI.Installer/InteractiveInstaller.cs127
-rw-r--r--src/SMAPI.Installer/Program.cs2
-rw-r--r--src/SMAPI.Installer/Properties/AssemblyInfo.cs4
-rw-r--r--src/SMAPI.Installer/README.txt4
-rw-r--r--src/SMAPI.Installer/SMAPI.Installer.csproj (renamed from src/SMAPI.Installer/StardewModdingAPI.Installer.csproj)12
-rw-r--r--src/SMAPI.Installer/unix-launcher.sh94
7 files changed, 81 insertions, 164 deletions
diff --git a/src/SMAPI.Installer/Framework/InstallerPaths.cs b/src/SMAPI.Installer/Framework/InstallerPaths.cs
index e5396018..9393e14f 100644
--- a/src/SMAPI.Installer/Framework/InstallerPaths.cs
+++ b/src/SMAPI.Installer/Framework/InstallerPaths.cs
@@ -59,7 +59,7 @@ namespace StardewModdingAPI.Installer.Framework
this.UnixLauncherPath = Path.Combine(gameDir.FullName, "StardewValley");
this.UnixSmapiLauncherPath = Path.Combine(gameDir.FullName, "StardewModdingAPI");
this.UnixBackupLauncherPath = Path.Combine(gameDir.FullName, "StardewValley-original");
- this.ApiConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "StardewModdingAPI.config.json");
+ this.ApiConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "config.json");
}
}
}
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index 7148b1d9..964300ac 100644
--- a/src/SMAPI.Installer/InteractiveInstaller.cs
+++ b/src/SMAPI.Installer/InteractiveInstaller.cs
@@ -7,7 +7,6 @@ using System.Threading;
using Microsoft.Win32;
using StardewModdingApi.Installer.Enums;
using StardewModdingAPI.Installer.Framework;
-using StardewModdingAPI.Internal;
using StardewModdingAPI.Internal.ConsoleWriting;
using StardewModdingAPI.Toolkit;
using StardewModdingAPI.Toolkit.Framework.ModScanning;
@@ -37,64 +36,7 @@ namespace StardewModdingApi.Installer
"SMAPI.ConsoleCommands"
};
- /// <summary>The default file paths where Stardew Valley can be installed.</summary>
- /// <param name="platform">The target platform.</param>
- /// <remarks>Derived from the crossplatform mod config: https://github.com/Pathoschild/Stardew.ModBuildConfig. </remarks>
- private IEnumerable<string> GetDefaultInstallPaths(Platform platform)
- {
- switch (platform)
- {
- case Platform.Linux:
- case Platform.Mac:
- {
- string home = Environment.GetEnvironmentVariable("HOME");
- // Linux
- yield return $"{home}/GOG Games/Stardew Valley/game";
- yield return Directory.Exists($"{home}/.steam/steam/steamapps/common/Stardew Valley")
- ? $"{home}/.steam/steam/steamapps/common/Stardew Valley"
- : $"{home}/.local/share/Steam/steamapps/common/Stardew Valley";
-
- // Mac
- yield return "/Applications/Stardew Valley.app/Contents/MacOS";
- yield return $"{home}/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS";
- }
- break;
-
- case Platform.Windows:
- {
- // Windows
- foreach (string programFiles in new[] { @"C:\Program Files", @"C:\Program Files (x86)" })
- {
- yield return $@"{programFiles}\GalaxyClient\Games\Stardew Valley";
- yield return $@"{programFiles}\GOG Galaxy\Games\Stardew Valley";
- yield return $@"{programFiles}\Steam\steamapps\common\Stardew Valley";
- }
-
- // Windows registry
- IDictionary<string, string> registryKeys = new Dictionary<string, string>
- {
- [@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150"] = "InstallLocation", // Steam
- [@"SOFTWARE\WOW6432Node\GOG.com\Games\1453375253"] = "PATH", // GOG on 64-bit Windows
- };
- foreach (var pair in registryKeys)
- {
- string path = this.GetLocalMachineRegistryValue(pair.Key, pair.Value);
- if (!string.IsNullOrWhiteSpace(path))
- yield return path;
- }
-
- // via Steam library path
- string steampath = this.GetCurrentUserRegistryValue(@"Software\Valve\Steam", "SteamPath");
- if (steampath != null)
- yield return Path.Combine(steampath.Replace('/', '\\'), @"steamapps\common\Stardew Valley");
- }
- break;
-
- default:
- throw new InvalidOperationException($"Unknown platform '{platform}'.");
- }
- }
/// <summary>Get the absolute file or folder paths to remove when uninstalling SMAPI.</summary>
/// <param name="installDir">The folder for Stardew Valley and SMAPI.</param>
@@ -112,6 +54,7 @@ namespace StardewModdingApi.Installer
yield return GetInstallPath("StardewModdingAPI.pdb"); // Windows only
yield return GetInstallPath("StardewModdingAPI.xml");
yield return GetInstallPath("smapi-internal");
+ yield return GetInstallPath("steam_appid.txt");
// obsolete
yield return GetInstallPath(Path.Combine("Mods", ".cache")); // 1.3-1.4
@@ -133,11 +76,9 @@ namespace StardewModdingApi.Installer
yield return GetInstallPath("StardewModdingAPI.Toolkit.CoreInterfaces.dll"); // moved in 2.8
yield return GetInstallPath("StardewModdingAPI.Toolkit.CoreInterfaces.pdb"); // moved in 2.8
yield return GetInstallPath("StardewModdingAPI.Toolkit.CoreInterfaces.xml"); // moved in 2.8
- yield return GetInstallPath("StardewModdingAPI.xml"); // moved in 2.8
yield return GetInstallPath("System.Numerics.dll"); // moved in 2.8
yield return GetInstallPath("System.Runtime.Caching.dll"); // moved in 2.8
yield return GetInstallPath("System.ValueTuple.dll"); // moved in 2.8
- yield return GetInstallPath("steam_appid.txt"); // moved in 2.8
if (modsDir.Exists)
{
@@ -159,13 +100,13 @@ namespace StardewModdingApi.Installer
public InteractiveInstaller(string bundlePath)
{
this.BundlePath = bundlePath;
- this.ConsoleWriter = new ColorfulConsoleWriter(EnvironmentUtility.DetectPlatform(), MonitorColorScheme.AutoDetect);
+ this.ConsoleWriter = new ColorfulConsoleWriter(EnvironmentUtility.DetectPlatform());
}
/// <summary>Run the install or uninstall script.</summary>
/// <param name="args">The command line arguments.</param>
/// <remarks>
- /// Initialisation flow:
+ /// Initialization flow:
/// 1. Collect information (mainly OS and install path) and validate it.
/// 2. Ask the user whether to install or uninstall.
///
@@ -187,8 +128,9 @@ namespace StardewModdingApi.Installer
** Step 1: initial setup
*********/
/****
- ** Get platform & set window title
+ ** Get basic info & set window title
****/
+ ModToolkit toolkit = new ModToolkit();
Platform platform = EnvironmentUtility.DetectPlatform();
Console.Title = $"SMAPI {this.GetDisplayVersion(this.GetType().Assembly.GetName().Version)} installer on {platform} {EnvironmentUtility.GetFriendlyPlatformName(platform)}";
Console.WriteLine();
@@ -275,8 +217,8 @@ namespace StardewModdingApi.Installer
** show theme selector
****/
// get theme writers
- var lightBackgroundWriter = new ColorfulConsoleWriter(EnvironmentUtility.DetectPlatform(), MonitorColorScheme.LightBackground);
- var darkDarkgroundWriter = new ColorfulConsoleWriter(EnvironmentUtility.DetectPlatform(), MonitorColorScheme.DarkBackground);
+ var lightBackgroundWriter = new ColorfulConsoleWriter(platform, ColorfulConsoleWriter.GetDefaultColorSchemeConfig(MonitorColorScheme.LightBackground));
+ var darkBackgroundWriter = new ColorfulConsoleWriter(platform, ColorfulConsoleWriter.GetDefaultColorSchemeConfig(MonitorColorScheme.DarkBackground));
// print question
this.PrintPlain("Which text looks more readable?");
@@ -284,7 +226,7 @@ namespace StardewModdingApi.Installer
Console.Write(" [1] ");
lightBackgroundWriter.WriteLine("Dark text on light background", ConsoleLogLevel.Info);
Console.Write(" [2] ");
- darkDarkgroundWriter.WriteLine("Light text on dark background", ConsoleLogLevel.Info);
+ darkBackgroundWriter.WriteLine("Light text on dark background", ConsoleLogLevel.Info);
Console.WriteLine();
// handle choice
@@ -297,7 +239,7 @@ namespace StardewModdingApi.Installer
break;
case "2":
scheme = MonitorColorScheme.DarkBackground;
- this.ConsoleWriter = darkDarkgroundWriter;
+ this.ConsoleWriter = darkBackgroundWriter;
break;
default:
throw new InvalidOperationException($"Unexpected action key '{choice}'.");
@@ -324,7 +266,7 @@ namespace StardewModdingApi.Installer
****/
// get game path
this.PrintInfo("Where is your game folder?");
- DirectoryInfo installDir = this.InteractivelyGetInstallPath(platform, gamePathArg);
+ DirectoryInfo installDir = this.InteractivelyGetInstallPath(platform, toolkit, gamePathArg);
if (installDir == null)
{
this.PrintError("Failed finding your game path.");
@@ -490,7 +432,6 @@ namespace StardewModdingApi.Installer
{
this.PrintDebug("Adding bundled mods...");
- ModToolkit toolkit = new ModToolkit();
ModFolder[] targetMods = toolkit.GetModFolders(paths.ModsPath).ToArray();
foreach (ModFolder sourceMod in toolkit.GetModFolders(bundledModsDir.FullName))
{
@@ -529,7 +470,7 @@ namespace StardewModdingApi.Installer
{
string text = File
.ReadAllText(paths.ApiConfigPath)
- .Replace(@"""ColorScheme"": ""AutoDetect""", $@"""ColorScheme"": ""{scheme}""");
+ .Replace(@"""UseScheme"": ""AutoDetect""", $@"""UseScheme"": ""{scheme}""");
File.WriteAllText(paths.ApiConfigPath, text);
}
@@ -598,32 +539,6 @@ namespace StardewModdingApi.Installer
}
}
- /// <summary>Get the value of a key in the Windows HKLM registry.</summary>
- /// <param name="key">The full path of the registry key relative to HKLM.</param>
- /// <param name="name">The name of the value.</param>
- private string GetLocalMachineRegistryValue(string key, string name)
- {
- RegistryKey localMachine = Environment.Is64BitOperatingSystem ? RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64) : Registry.LocalMachine;
- RegistryKey openKey = localMachine.OpenSubKey(key);
- if (openKey == null)
- return null;
- using (openKey)
- return (string)openKey.GetValue(name);
- }
-
- /// <summary>Get the value of a key in the Windows HKCU registry.</summary>
- /// <param name="key">The full path of the registry key relative to HKCU.</param>
- /// <param name="name">The name of the value.</param>
- private string GetCurrentUserRegistryValue(string key, string name)
- {
- RegistryKey currentuser = Environment.Is64BitOperatingSystem ? RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64) : Registry.CurrentUser;
- RegistryKey openKey = currentuser.OpenSubKey(key);
- if (openKey == null)
- return null;
- using (openKey)
- return (string)openKey.GetValue(name);
- }
-
/// <summary>Print a message without formatting.</summary>
/// <param name="text">The text to print.</param>
private void PrintPlain(string text) => Console.WriteLine(text);
@@ -731,7 +646,7 @@ namespace StardewModdingApi.Installer
/// <summary>Delete a file or folder regardless of file permissions, and block until deletion completes.</summary>
/// <param name="entry">The file or folder to reset.</param>
- /// <remarks>This method is mirred from <c>FileUtilities.ForceDelete</c> in the toolkit.</remarks>
+ /// <remarks>This method is mirrored from <c>FileUtilities.ForceDelete</c> in the toolkit.</remarks>
private void ForceDelete(FileSystemInfo entry)
{
// ignore if already deleted
@@ -789,8 +704,9 @@ namespace StardewModdingApi.Installer
/// <summary>Interactively locate the game install path to update.</summary>
/// <param name="platform">The current platform.</param>
+ /// <param name="toolkit">The mod toolkit.</param>
/// <param name="specifiedPath">The path specified as a command-line argument (if any), which should override automatic path detection.</param>
- private DirectoryInfo InteractivelyGetInstallPath(Platform platform, string specifiedPath)
+ private DirectoryInfo InteractivelyGetInstallPath(Platform platform, ModToolkit toolkit, string specifiedPath)
{
// get executable name
string executableFilename = EnvironmentUtility.GetExecutableName(platform);
@@ -813,18 +729,7 @@ namespace StardewModdingApi.Installer
}
// get installed paths
- DirectoryInfo[] defaultPaths =
- (
- from path in this.GetDefaultInstallPaths(platform).Distinct(StringComparer.InvariantCultureIgnoreCase)
- let dir = new DirectoryInfo(path)
- where dir.Exists && dir.EnumerateFiles(executableFilename).Any()
- select dir
- )
- .GroupBy(p => p.FullName, StringComparer.InvariantCultureIgnoreCase) // ignore duplicate paths
- .Select(p => p.First())
- .ToArray();
-
- // choose where to install
+ DirectoryInfo[] defaultPaths = toolkit.GetGameFolders().ToArray();
if (defaultPaths.Any())
{
// only one path
@@ -857,7 +762,7 @@ namespace StardewModdingApi.Installer
continue;
}
- // normalise path
+ // normalize path
if (platform == Platform.Windows)
path = path.Replace("\"", ""); // in Windows, quotes are used to escape spaces and aren't part of the file path
if (platform == Platform.Linux || platform == Platform.Mac)
diff --git a/src/SMAPI.Installer/Program.cs b/src/SMAPI.Installer/Program.cs
index 3c4d8593..b7fa45f5 100644
--- a/src/SMAPI.Installer/Program.cs
+++ b/src/SMAPI.Installer/Program.cs
@@ -36,7 +36,7 @@ namespace StardewModdingApi.Installer
FileInfo zipFile = new FileInfo(Path.Combine(Program.InstallerPath, $"{(platform == PlatformID.Win32NT ? "windows" : "unix")}-install.dat"));
if (!zipFile.Exists)
{
- Console.WriteLine($"Oops! Some of the installer files are missing; try redownloading the installer. (Missing file: {zipFile.FullName})");
+ Console.WriteLine($"Oops! Some of the installer files are missing; try re-downloading the installer. (Missing file: {zipFile.FullName})");
Console.ReadLine();
return;
}
diff --git a/src/SMAPI.Installer/Properties/AssemblyInfo.cs b/src/SMAPI.Installer/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9838e5a0..00000000
--- a/src/SMAPI.Installer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-using System.Reflection;
-
-[assembly: AssemblyTitle("SMAPI.Installer")]
-[assembly: AssemblyDescription("The SMAPI installer for players.")]
diff --git a/src/SMAPI.Installer/README.txt b/src/SMAPI.Installer/README.txt
index 79c90cc0..0da49a46 100644
--- a/src/SMAPI.Installer/README.txt
+++ b/src/SMAPI.Installer/README.txt
@@ -40,5 +40,5 @@ When installing on Linux or Mac:
- Make sure Mono is installed (normally the installer checks for you). While it's not required,
many mods won't work correctly without it. (Specifically, mods which load PNG images may crash or
freeze the game.)
-- To configure the color scheme, edit the `smapi-internal/StardewModdingAPI.config.json` file and
- see instructions there for the 'ColorScheme' setting.
+- To configure the color scheme, edit the `smapi-internal/config.json` file and see instructions
+ there for the 'ColorScheme' setting.
diff --git a/src/SMAPI.Installer/StardewModdingAPI.Installer.csproj b/src/SMAPI.Installer/SMAPI.Installer.csproj
index ac64a774..3f01c8fe 100644
--- a/src/SMAPI.Installer/StardewModdingAPI.Installer.csproj
+++ b/src/SMAPI.Installer/SMAPI.Installer.csproj
@@ -1,10 +1,10 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <AssemblyName>SMAPI.Installer</AssemblyName>
<RootNamespace>StardewModdingAPI.Installer</RootNamespace>
- <AssemblyName>StardewModdingAPI.Installer</AssemblyName>
+ <Description>The SMAPI installer for players.</Description>
<TargetFramework>net45</TargetFramework>
- <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
<PlatformTarget>x86</PlatformTarget>
@@ -13,11 +13,7 @@
</PropertyGroup>
<ItemGroup>
- <Compile Include="..\..\build\GlobalAssemblyInfo.cs" Link="Properties\GlobalAssemblyInfo.cs" />
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\SMAPI.Toolkit\StardewModdingAPI.Toolkit.csproj" />
+ <ProjectReference Include="..\SMAPI.Toolkit\SMAPI.Toolkit.csproj" />
</ItemGroup>
<ItemGroup>
diff --git a/src/SMAPI.Installer/unix-launcher.sh b/src/SMAPI.Installer/unix-launcher.sh
index a98d527d..f81828f0 100644
--- a/src/SMAPI.Installer/unix-launcher.sh
+++ b/src/SMAPI.Installer/unix-launcher.sh
@@ -1,14 +1,14 @@
-#!/bin/bash
+#!/usr/bin/env bash
# MonoKickstart Shell Script
# Written by Ethan "flibitijibibo" Lee
-# Modified for StardewModdingAPI by Viz and Pathoschild
+# Modified for SMAPI by various contributors
# Move to script's directory
-cd "`dirname "$0"`"
+cd "$(dirname "$0")" || exit $?
# Get the system architecture
-UNAME=`uname`
-ARCH=`uname -m`
+UNAME=$(uname)
+ARCH=$(uname -m)
# MonoKickstart picks the right libfolder, so just execute the right binary.
if [ "$UNAME" == "Darwin" ]; then
@@ -39,18 +39,18 @@ if [ "$UNAME" == "Darwin" ]; then
# launch SMAPI
cp StardewValley.bin.osx StardewModdingAPI.bin.osx
- open -a Terminal ./StardewModdingAPI.bin.osx $@
+ open -a Terminal ./StardewModdingAPI.bin.osx "$@"
else
# choose launcher
LAUNCHER=""
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
# get cross-distro version of POSIX command
@@ -61,37 +61,57 @@ else
COMMAND="type"
fi
- # open SMAPI in terminal
- if $COMMAND xterm 2>/dev/null; then
- xterm -e "$LAUNCHER"
- elif $COMMAND x-terminal-emulator 2>/dev/null; then
- # Terminator converts -e to -x when used through x-terminal-emulator for some reason (per
- # `man terminator`), which causes an "unable to find shell" error. If x-terminal-emulator
- # is mapped to Terminator, invoke it directly instead.
- if [[ "$(readlink -e $(which x-terminal-emulator))" == *"/terminator" ]]; then
- terminator -e "sh -c 'TERM=xterm $LAUNCHER'"
- else
- x-terminal-emulator -e "sh -c 'TERM=xterm $LAUNCHER'"
+ # select terminal (prefer $TERMINAL for overrides and testing, then xterm for best compatibility, then known supported terminals)
+ for terminal in "$TERMINAL" xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite 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
fi
- elif $COMMAND xfce4-terminal 2>/dev/null; then
- xfce4-terminal -e "sh -c 'TERM=xterm $LAUNCHER'"
- elif $COMMAND gnome-terminal 2>/dev/null; then
- gnome-terminal -e "sh -c 'TERM=xterm $LAUNCHER'"
- elif $COMMAND konsole 2>/dev/null; then
- konsole -p Environment=TERM=xterm -e "$LAUNCHER"
- elif $COMMAND terminal 2>/dev/null; then
- terminal -e "sh -c 'TERM=xterm $LAUNCHER'"
- elif $COMMAND termite 2>/dev/null; then
- termite -e "sh -c 'TERM=xterm $LAUNCHER'"
- else
+ 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
fi
- # some Linux users get error 127 (command not found) from the above block, even though
- # `command -v` indicates the command is valid. As a fallback, launch SMAPI without a terminal when
- # that happens and pass in an argument indicating SMAPI shouldn't try writing to the terminal
- # (which can be slow if there is none).
- if [ $? -eq 127 ]; then
- $LAUNCHER --no-terminal
- 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
+ ;;
+ kitty)
+ # Kitty overrides the TERM varible unless you set it explicitly
+ kitty -o term=xterm $LAUNCHER
+ ;;
+ xterm|xfce4-terminal|gnome-terminal|terminal|termite)
+ $LAUNCHTERM -e "sh -c 'TERM=xterm $LAUNCHER'"
+ ;;
+ konsole)
+ konsole -p Environment=TERM=xterm -e "$LAUNCHER"
+ ;;
+ *)
+ # If we don't know the terminal, just try to run it in the current shell.
+ sh -c 'TERM=xterm $LAUNCHER'
+ # if THAT fails, launch with no output
+ if [ $? -eq 127 ]; then
+ $LAUNCHER --no-terminal
+ fi
+ esac
fi