compile separate Linux/Mac installer to avoid WMI reference errors (#485)

This commit is contained in:
Jesse Plamondon-Willard 2018-05-02 21:51:06 -04:00
parent 8425f53b7d
commit ff55901025
3 changed files with 13 additions and 4 deletions

View File

@ -18,12 +18,13 @@
<RemoveDir Directories="$(PackagePath)" /> <RemoveDir Directories="$(PackagePath)" />
<!-- copy installer files --> <!-- copy installer files -->
<Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackagePath)\install.exe" /> <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackagePath)\install.exe" />
<Copy SourceFiles="$(TargetDir)\readme.txt" DestinationFiles="$(PackagePath)\README.txt" /> <Copy SourceFiles="$(TargetDir)\readme.txt" DestinationFiles="$(PackagePath)\README.txt" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(TargetDir)\unix-launcher.sh" DestinationFiles="$(PackageInternalPath)\Mono\StardewModdingAPI" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(TargetDir)\unix-launcher.sh" DestinationFiles="$(PackageInternalPath)\Mono\StardewModdingAPI" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(TargetDir)\unix-install.sh" DestinationFiles="$(PackagePath)\install.sh" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(TargetDir)\unix-install.sh" DestinationFiles="$(PackagePath)\install.sh" />
<!-- copy SMAPI files for Mono --> <!-- copy SMAPI files for Mono -->
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackageInternalPath)\Mono\install.exe" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\Mono.Cecil.dll" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\Mono.Cecil.dll" DestinationFolder="$(PackageInternalPath)\Mono" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\Newtonsoft.Json.dll" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\Newtonsoft.Json.dll" DestinationFolder="$(PackageInternalPath)\Mono" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.exe" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.exe" DestinationFolder="$(PackageInternalPath)\Mono" />

View File

@ -17,6 +17,9 @@ namespace StardewModdingApi.Installer
/********* /*********
** Properties ** Properties
*********/ *********/
/// <summary>The name of the installer file in the package.</summary>
private readonly string InstallerFileName = "install.exe";
/// <summary>The <see cref="Environment.OSVersion"/> value that represents Windows 7.</summary> /// <summary>The <see cref="Environment.OSVersion"/> value that represents Windows 7.</summary>
private readonly Version Windows7Version = new Version(6, 1); private readonly Version Windows7Version = new Version(6, 1);
@ -82,7 +85,7 @@ namespace StardewModdingApi.Installer
yield return GetInstallPath("Newtonsoft.Json.dll"); yield return GetInstallPath("Newtonsoft.Json.dll");
yield return GetInstallPath("StardewModdingAPI.exe"); yield return GetInstallPath("StardewModdingAPI.exe");
yield return GetInstallPath("StardewModdingAPI.config.json"); 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("StardewModdingAPI.Internal.dll");
yield return GetInstallPath("System.ValueTuple.dll"); yield return GetInstallPath("System.ValueTuple.dll");
yield return GetInstallPath("steam_appid.txt"); yield return GetInstallPath("steam_appid.txt");
@ -180,7 +183,9 @@ namespace StardewModdingApi.Installer
} }
// get folders // 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")); DirectoryInfo modsDir = new DirectoryInfo(Path.Combine(installDir.FullName, "Mods"));
var paths = new var paths = new
{ {
@ -300,6 +305,9 @@ namespace StardewModdingApi.Installer
this.PrintDebug("Adding SMAPI files..."); this.PrintDebug("Adding SMAPI files...");
foreach (FileInfo sourceFile in packageDir.EnumerateFiles().Where(this.ShouldCopyFile)) foreach (FileInfo sourceFile in packageDir.EnumerateFiles().Where(this.ShouldCopyFile))
{ {
if (sourceFile.Name == this.InstallerFileName)
continue;
string targetPath = Path.Combine(installDir.FullName, sourceFile.Name); string targetPath = Path.Combine(installDir.FullName, sourceFile.Name);
this.InteractivelyDelete(targetPath); this.InteractivelyDelete(targetPath);
sourceFile.CopyTo(targetPath); sourceFile.CopyTo(targetPath);

View File

@ -14,7 +14,7 @@ fi
# validate Mono & run installer # validate Mono & run installer
if $COMMAND mono >/dev/null 2>&1; then if $COMMAND mono >/dev/null 2>&1; then
mono install.exe mono internal/Mono/install.exe
else else
echo "Oops! Looks like Mono isn't installed. Please install Mono from http://mono-project.com, reboot, and run this installer again." echo "Oops! Looks like Mono isn't installed. Please install Mono from http://mono-project.com, reboot, and run this installer again."
read read