From ff55901025365a342e0794df86f6122603e614c8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 2 May 2018 21:51:06 -0400 Subject: [PATCH] compile separate Linux/Mac installer to avoid WMI reference errors (#485) --- build/prepare-install-package.targets | 3 ++- src/SMAPI.Installer/InteractiveInstaller.cs | 12 ++++++++++-- src/SMAPI.Installer/unix-install.sh | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/prepare-install-package.targets b/build/prepare-install-package.targets index 8410f60e..d67d271f 100644 --- a/build/prepare-install-package.targets +++ b/build/prepare-install-package.targets @@ -18,12 +18,13 @@ - + + diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index c0bc8f2c..3ce71673 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -17,6 +17,9 @@ namespace StardewModdingApi.Installer /********* ** Properties *********/ + /// The name of the installer file in the package. + private readonly string InstallerFileName = "install.exe"; + /// The value that represents Windows 7. private readonly Version Windows7Version = new Version(6, 1); @@ -82,7 +85,7 @@ namespace StardewModdingApi.Installer yield return GetInstallPath("Newtonsoft.Json.dll"); yield return GetInstallPath("StardewModdingAPI.exe"); yield return GetInstallPath("StardewModdingAPI.config.json"); - yield return GetInstallPath("StardewModdingAPI.data.json"); + yield return GetInstallPath("StardewModdingAPI.metadata.json"); yield return GetInstallPath("StardewModdingAPI.Internal.dll"); yield return GetInstallPath("System.ValueTuple.dll"); yield return GetInstallPath("steam_appid.txt"); @@ -180,7 +183,9 @@ namespace StardewModdingApi.Installer } // get folders - DirectoryInfo packageDir = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "internal", platform.IsMono() ? "Mono" : "Windows")); + DirectoryInfo packageDir = platform.IsMono() + ? new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) // installer runs from internal folder on Mono + : new DirectoryInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "internal", "Windows")); DirectoryInfo modsDir = new DirectoryInfo(Path.Combine(installDir.FullName, "Mods")); var paths = new { @@ -300,6 +305,9 @@ namespace StardewModdingApi.Installer this.PrintDebug("Adding SMAPI files..."); foreach (FileInfo sourceFile in packageDir.EnumerateFiles().Where(this.ShouldCopyFile)) { + if (sourceFile.Name == this.InstallerFileName) + continue; + string targetPath = Path.Combine(installDir.FullName, sourceFile.Name); this.InteractivelyDelete(targetPath); sourceFile.CopyTo(targetPath); diff --git a/src/SMAPI.Installer/unix-install.sh b/src/SMAPI.Installer/unix-install.sh index a0bd9346..df02bb37 100644 --- a/src/SMAPI.Installer/unix-install.sh +++ b/src/SMAPI.Installer/unix-install.sh @@ -14,7 +14,7 @@ fi # validate Mono & run installer if $COMMAND mono >/dev/null 2>&1; then - mono install.exe + mono internal/Mono/install.exe else echo "Oops! Looks like Mono isn't installed. Please install Mono from http://mono-project.com, reboot, and run this installer again." read