hide installer's bundled files to avoid confusion (#602)
This commit is contained in:
parent
41e3c28021
commit
e5bc00e7a2
|
@ -11,8 +11,8 @@
|
||||||
<CompiledSmapiPath>$(CompiledRootPath)\SMAPI</CompiledSmapiPath>
|
<CompiledSmapiPath>$(CompiledRootPath)\SMAPI</CompiledSmapiPath>
|
||||||
<CompiledToolkitPath>$(CompiledRootPath)\SMAPI.Toolkit\net4.5</CompiledToolkitPath>
|
<CompiledToolkitPath>$(CompiledRootPath)\SMAPI.Toolkit\net4.5</CompiledToolkitPath>
|
||||||
<PackagePath>$(SolutionDir)\..\bin\Packaged</PackagePath>
|
<PackagePath>$(SolutionDir)\..\bin\Packaged</PackagePath>
|
||||||
<PackageInternalPath Condition="$(OS) == 'Windows_NT'">$(PackagePath)\internal\Windows</PackageInternalPath>
|
<PackageBundleFilename>bundle.windows.zipped</PackageBundleFilename>
|
||||||
<PackageInternalPath Condition="$(OS) != 'Windows_NT'">$(PackagePath)\internal\Mono</PackageInternalPath>
|
<PackageBundleFilename Condition="$(OS) != 'Windows_NT'">bundle.mono.zipped</PackageBundleFilename>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CompiledMods Include="$(SolutionDir)\..\bin\$(Configuration)\Mods\**\*.*" />
|
<CompiledMods Include="$(SolutionDir)\..\bin\$(Configuration)\Mods\**\*.*" />
|
||||||
|
@ -22,38 +22,63 @@
|
||||||
<RemoveDir Directories="$(PackagePath)" />
|
<RemoveDir Directories="$(PackagePath)" />
|
||||||
|
|
||||||
<!-- copy installer files -->
|
<!-- copy installer files -->
|
||||||
<Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackageInternalPath)\install.exe" />
|
|
||||||
<Copy SourceFiles="$(TargetDir)\unix-launcher.sh" DestinationFiles="$(PackageInternalPath)\StardewModdingAPI" />
|
|
||||||
<Copy SourceFiles="$(TargetDir)\README.txt" DestinationFiles="$(PackagePath)\README.txt" />
|
|
||||||
<Copy SourceFiles="$(TargetDir)\unix-install.sh" DestinationFiles="$(PackagePath)\install on Linux.sh" />
|
<Copy SourceFiles="$(TargetDir)\unix-install.sh" DestinationFiles="$(PackagePath)\install on Linux.sh" />
|
||||||
<Copy SourceFiles="$(TargetDir)\unix-install.sh" DestinationFiles="$(PackagePath)\install on Mac.command" />
|
<Copy SourceFiles="$(TargetDir)\unix-install.sh" DestinationFiles="$(PackagePath)\install on Mac.command" />
|
||||||
<Copy SourceFiles="$(TargetDir)\windows-install.bat" DestinationFiles="$(PackagePath)\install on Windows.bat" />
|
<Copy SourceFiles="$(TargetDir)\windows-install.bat" DestinationFiles="$(PackagePath)\install on Windows.bat" />
|
||||||
|
<Copy SourceFiles="$(TargetDir)\README.txt" DestinationFiles="$(PackagePath)\README.txt" />
|
||||||
|
<Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackagePath)\internal\install.exe" />
|
||||||
|
<Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(TargetDir)\windows-exe-config.xml" DestinationFiles="$(PackagePath)\internal\install.exe.config" />
|
||||||
|
|
||||||
<!--copy *.exe.config files (needed to avoid security errors when loading DLLs)-->
|
<!--copy bundle files-->
|
||||||
<Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(TargetDir)\windows-exe-config.xml" DestinationFiles="$(PackageInternalPath)\install.exe.config" />
|
<Copy SourceFiles="$(TargetDir)\unix-launcher.sh" DestinationFiles="$(PackagePath)\bundle\StardewModdingAPI" />
|
||||||
<Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(TargetDir)\windows-exe-config.xml" DestinationFiles="$(PackageInternalPath)\StardewModdingAPI.exe.config" />
|
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.exe" DestinationFolder="$(PackagePath)\bundle" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.pdb" DestinationFolder="$(PackagePath)\bundle" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.xml" DestinationFolder="$(PackagePath)\bundle" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\steam_appid.txt" DestinationFolder="$(PackagePath)\bundle" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\0Harmony.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\0Harmony.pdb" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\Mono.Cecil.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\Newtonsoft.Json.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.config.json" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.metadata.json" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.pdb" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.xml" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.CoreInterfaces.pdb" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.CoreInterfaces.xml" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy SourceFiles="@(CompiledMods)" DestinationFolder="$(PackagePath)\bundle\Mods\%(RecursiveDir)" />
|
||||||
|
<Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(TargetDir)\windows-exe-config.xml" DestinationFiles="$(PackagePath)\bundle\StardewModdingAPI.exe.config" />
|
||||||
|
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.Numerics.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.Runtime.Caching.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" />
|
||||||
|
|
||||||
<!-- copy SMAPI files -->
|
<!-- zip bundle files -->
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.exe" DestinationFolder="$(PackageInternalPath)" />
|
<ZipDirectory FromDirPath="$(PackagePath)\bundle" ToFilePath="$(PackagePath)\internal\$(PackageBundleFilename)" />
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.pdb" DestinationFolder="$(PackageInternalPath)" />
|
<RemoveDir Directories="$(PackagePath)\bundle" />
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.xml" DestinationFolder="$(PackageInternalPath)" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\steam_appid.txt" DestinationFolder="$(PackageInternalPath)" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\0Harmony.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\0Harmony.pdb" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\Mono.Cecil.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\Newtonsoft.Json.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.config.json" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.metadata.json" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.pdb" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.xml" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.CoreInterfaces.pdb" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="$(CompiledToolkitPath)\StardewModdingAPI.Toolkit.CoreInterfaces.xml" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy SourceFiles="@(CompiledMods)" DestinationFolder="$(PackageInternalPath)\Mods\%(RecursiveDir)" />
|
|
||||||
|
|
||||||
<!--copy SMAPI files for Linux/Mac only -->
|
|
||||||
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.Numerics.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.Runtime.Caching.dll" DestinationFolder="$(PackageInternalPath)\smapi-internal" />
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<UsingTask TaskName="ZipDirectory" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
|
||||||
|
<ParameterGroup>
|
||||||
|
<FromDirPath ParameterType="System.String" Required="true" />
|
||||||
|
<ToFilePath ParameterType="System.String" Required="true" />
|
||||||
|
</ParameterGroup>
|
||||||
|
<Task>
|
||||||
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
|
<Using Namespace="System.IO.Compression" />
|
||||||
|
<Code Type="Fragment" Language="cs">
|
||||||
|
<![CDATA[
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ZipFile.CreateFromDirectory(FromDirPath, ToFilePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Log.LogErrorFromException(ex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</Code>
|
||||||
|
</Task>
|
||||||
|
</UsingTask>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* Reorganised SMAPI files:
|
* Reorganised SMAPI files:
|
||||||
* Most SMAPI files are now tucked into a `smapi-internal` subfolder.
|
* Most SMAPI files are now tucked into a `smapi-internal` subfolder.
|
||||||
* Save backups are now in a `save-backups` subfolder, so they're easier to access. Note that previous backups will be deleted when you update.
|
* Save backups are now in a `save-backups` subfolder, so they're easier to access. Note that previous backups will be deleted when you update.
|
||||||
|
* Simplified the installer files to avoid confusion.
|
||||||
* Added support for organising mods:
|
* Added support for organising mods:
|
||||||
* You can now group mods into subfolders to organise them.
|
* You can now group mods into subfolders to organise them.
|
||||||
* You can now mark a mod folder ignored by starting the name with a dot (like `.disabled mods`).
|
* You can now mark a mod folder ignored by starting the name with a dot (like `.disabled mods`).
|
||||||
|
|
|
@ -8,8 +8,8 @@ namespace StardewModdingAPI.Installer.Framework
|
||||||
/*********
|
/*********
|
||||||
** Accessors
|
** Accessors
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The directory containing the installer files for the current platform.</summary>
|
/// <summary>The directory path containing the files to copy into the game folder.</summary>
|
||||||
public DirectoryInfo PackageDir { get; }
|
public DirectoryInfo BundleDir { get; }
|
||||||
|
|
||||||
/// <summary>The directory containing the installed game.</summary>
|
/// <summary>The directory containing the installed game.</summary>
|
||||||
public DirectoryInfo GameDir { get; }
|
public DirectoryInfo GameDir { get; }
|
||||||
|
@ -17,8 +17,8 @@ namespace StardewModdingAPI.Installer.Framework
|
||||||
/// <summary>The directory into which to install mods.</summary>
|
/// <summary>The directory into which to install mods.</summary>
|
||||||
public DirectoryInfo ModsDir { get; }
|
public DirectoryInfo ModsDir { get; }
|
||||||
|
|
||||||
/// <summary>The full path to the directory containing the installer files for the current platform.</summary>
|
/// <summary>The full path to directory path containing the files to copy into the game folder.</summary>
|
||||||
public string PackagePath => this.PackageDir.FullName;
|
public string BundlePath => this.BundleDir.FullName;
|
||||||
|
|
||||||
/// <summary>The full path to the directory containing the installed game.</summary>
|
/// <summary>The full path to the directory containing the installed game.</summary>
|
||||||
public string GamePath => this.GameDir.FullName;
|
public string GamePath => this.GameDir.FullName;
|
||||||
|
@ -46,12 +46,12 @@ namespace StardewModdingAPI.Installer.Framework
|
||||||
** Public methods
|
** Public methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>Construct an instance.</summary>
|
/// <summary>Construct an instance.</summary>
|
||||||
/// <param name="packageDir">The directory path containing the installer files for the current platform.</param>
|
/// <param name="bundleDir">The directory path containing the files to copy into the game folder.</param>
|
||||||
/// <param name="gameDir">The directory path for the installed game.</param>
|
/// <param name="gameDir">The directory path for the installed game.</param>
|
||||||
/// <param name="gameExecutableName">The name of the game's executable file for the current platform.</param>
|
/// <param name="gameExecutableName">The name of the game's executable file for the current platform.</param>
|
||||||
public InstallerPaths(DirectoryInfo packageDir, DirectoryInfo gameDir, string gameExecutableName)
|
public InstallerPaths(DirectoryInfo bundleDir, DirectoryInfo gameDir, string gameExecutableName)
|
||||||
{
|
{
|
||||||
this.PackageDir = packageDir;
|
this.BundleDir = bundleDir;
|
||||||
this.GameDir = gameDir;
|
this.GameDir = gameDir;
|
||||||
this.ModsDir = new DirectoryInfo(Path.Combine(gameDir.FullName, "Mods"));
|
this.ModsDir = new DirectoryInfo(Path.Combine(gameDir.FullName, "Mods"));
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using StardewModdingApi.Installer.Enums;
|
using StardewModdingApi.Installer.Enums;
|
||||||
|
@ -22,8 +21,8 @@ namespace StardewModdingApi.Installer
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** Properties
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The name of the installer file in the package.</summary>
|
/// <summary>The absolute path to the directory containing the files to copy into the game folder.</summary>
|
||||||
private readonly string InstallerFileName = "install.exe";
|
private readonly string BundlePath;
|
||||||
|
|
||||||
/// <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);
|
||||||
|
@ -153,8 +152,10 @@ namespace StardewModdingApi.Installer
|
||||||
** Public methods
|
** Public methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>Construct an instance.</summary>
|
/// <summary>Construct an instance.</summary>
|
||||||
public InteractiveInstaller()
|
/// <param name="bundlePath">The absolute path to the directory containing the files to copy into the game folder.</param>
|
||||||
|
public InteractiveInstaller(string bundlePath)
|
||||||
{
|
{
|
||||||
|
this.BundlePath = bundlePath;
|
||||||
this.ConsoleWriter = new ColorfulConsoleWriter(EnvironmentUtility.DetectPlatform(), MonitorColorScheme.AutoDetect);
|
this.ConsoleWriter = new ColorfulConsoleWriter(EnvironmentUtility.DetectPlatform(), MonitorColorScheme.AutoDetect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,8 +330,8 @@ namespace StardewModdingApi.Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
// get folders
|
// get folders
|
||||||
DirectoryInfo packageDir = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
|
DirectoryInfo bundleDir = new DirectoryInfo(this.BundlePath);
|
||||||
paths = new InstallerPaths(packageDir, installDir, EnvironmentUtility.GetExecutableName(platform));
|
paths = new InstallerPaths(bundleDir, installDir, EnvironmentUtility.GetExecutableName(platform));
|
||||||
}
|
}
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
|
|
||||||
|
@ -338,24 +339,12 @@ namespace StardewModdingApi.Installer
|
||||||
/*********
|
/*********
|
||||||
** Step 4: validate assumptions
|
** Step 4: validate assumptions
|
||||||
*********/
|
*********/
|
||||||
{
|
|
||||||
if (!paths.PackageDir.Exists)
|
|
||||||
{
|
|
||||||
this.PrintError(platform == Platform.Windows && paths.PackagePath.Contains(Path.GetTempPath()) && paths.PackagePath.Contains(".zip")
|
|
||||||
? "The installer is missing some files. It looks like you're running the installer from inside the downloaded zip; make sure you unzip the downloaded file first, then run the installer from the unzipped folder."
|
|
||||||
: $"The 'internal/{paths.PackageDir.Name}' package folder is missing (should be at {paths.PackagePath})."
|
|
||||||
);
|
|
||||||
Console.ReadLine();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!File.Exists(paths.ExecutablePath))
|
if (!File.Exists(paths.ExecutablePath))
|
||||||
{
|
{
|
||||||
this.PrintError("The detected game install path doesn't contain a Stardew Valley executable.");
|
this.PrintError("The detected game install path doesn't contain a Stardew Valley executable.");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
|
@ -446,11 +435,8 @@ namespace StardewModdingApi.Installer
|
||||||
{
|
{
|
||||||
// copy SMAPI files to game dir
|
// copy SMAPI files to game dir
|
||||||
this.PrintDebug("Adding SMAPI files...");
|
this.PrintDebug("Adding SMAPI files...");
|
||||||
foreach (FileSystemInfo sourceEntry in paths.PackageDir.EnumerateFileSystemInfos().Where(this.ShouldCopy))
|
foreach (FileSystemInfo sourceEntry in paths.BundleDir.EnumerateFileSystemInfos().Where(this.ShouldCopy))
|
||||||
{
|
{
|
||||||
if (sourceEntry.Name.StartsWith(this.InstallerFileName)) // e.g. install.exe or install.exe.config
|
|
||||||
continue;
|
|
||||||
|
|
||||||
this.InteractivelyDelete(Path.Combine(paths.GameDir.FullName, sourceEntry.Name));
|
this.InteractivelyDelete(Path.Combine(paths.GameDir.FullName, sourceEntry.Name));
|
||||||
this.RecursiveCopy(sourceEntry, paths.GameDir);
|
this.RecursiveCopy(sourceEntry, paths.GameDir);
|
||||||
}
|
}
|
||||||
|
@ -478,14 +464,14 @@ namespace StardewModdingApi.Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
// add or replace bundled mods
|
// add or replace bundled mods
|
||||||
DirectoryInfo packagedModsDir = new DirectoryInfo(Path.Combine(paths.PackageDir.FullName, "Mods"));
|
DirectoryInfo bundledModsDir = new DirectoryInfo(Path.Combine(paths.BundlePath, "Mods"));
|
||||||
if (packagedModsDir.Exists && packagedModsDir.EnumerateDirectories().Any())
|
if (bundledModsDir.Exists && bundledModsDir.EnumerateDirectories().Any())
|
||||||
{
|
{
|
||||||
this.PrintDebug("Adding bundled mods...");
|
this.PrintDebug("Adding bundled mods...");
|
||||||
|
|
||||||
ModToolkit toolkit = new ModToolkit();
|
ModToolkit toolkit = new ModToolkit();
|
||||||
ModFolder[] targetMods = toolkit.GetModFolders(paths.ModsPath).ToArray();
|
ModFolder[] targetMods = toolkit.GetModFolders(paths.ModsPath).ToArray();
|
||||||
foreach (ModFolder sourceMod in toolkit.GetModFolders(packagedModsDir.FullName))
|
foreach (ModFolder sourceMod in toolkit.GetModFolders(bundledModsDir.FullName))
|
||||||
{
|
{
|
||||||
// validate source mod
|
// validate source mod
|
||||||
if (sourceMod.Manifest == null)
|
if (sourceMod.Manifest == null)
|
||||||
|
@ -527,7 +513,7 @@ namespace StardewModdingApi.Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove obsolete appdata mods
|
// remove obsolete appdata mods
|
||||||
this.InteractivelyRemoveAppDataMods(paths.ModsDir, packagedModsDir);
|
this.InteractivelyRemoveAppDataMods(paths.ModsDir, bundledModsDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using StardewModdingAPI.Internal;
|
||||||
|
using StardewModdingAPI.Toolkit.Utilities;
|
||||||
|
|
||||||
namespace StardewModdingApi.Installer
|
namespace StardewModdingApi.Installer
|
||||||
{
|
{
|
||||||
|
@ -11,9 +14,15 @@ namespace StardewModdingApi.Installer
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** Properties
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The absolute path to search for referenced assemblies.</summary>
|
/// <summary>The absolute path of the installer folder.</summary>
|
||||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute", Justification = "The assembly location is never null in this context.")]
|
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute", Justification = "The assembly location is never null in this context.")]
|
||||||
private static readonly string DllSearchPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "smapi-internal");
|
private static readonly string InstallerPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||||
|
|
||||||
|
/// <summary>The absolute path of the folder containing the unzipped installer files.</summary>
|
||||||
|
private static readonly string ExtractedBundlePath = Path.Combine(Path.GetTempPath(), $"SMAPI-installer-{Guid.NewGuid():N}");
|
||||||
|
|
||||||
|
/// <summary>The absolute path for referenced assemblies.</summary>
|
||||||
|
private static readonly string InternalFilesPath = Path.Combine(Program.ExtractedBundlePath, "smapi-internal");
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Public methods
|
** Public methods
|
||||||
|
@ -22,11 +31,26 @@ namespace StardewModdingApi.Installer
|
||||||
/// <param name="args">The command line arguments.</param>
|
/// <param name="args">The command line arguments.</param>
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// find install bundle
|
||||||
|
PlatformID platform = Environment.OSVersion.Platform;
|
||||||
|
FileInfo zipFile = new FileInfo(Path.Combine(Program.InstallerPath, $"bundle.{(platform == PlatformID.Win32NT ? "windows" : "mono")}.zipped"));
|
||||||
|
if (!zipFile.Exists)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Oops! Some of the installer files are missing; try redownloading the installer. (Missing file: {zipFile.FullName})");
|
||||||
|
Console.ReadLine();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unzip bundle into temp folder
|
||||||
|
DirectoryInfo bundleDir = new DirectoryInfo(Program.ExtractedBundlePath);
|
||||||
|
Console.WriteLine("Extracting install files...");
|
||||||
|
ZipFile.ExtractToDirectory(zipFile.FullName, bundleDir.FullName);
|
||||||
|
|
||||||
// set up assembly resolution
|
// set up assembly resolution
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve;
|
AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve;
|
||||||
|
|
||||||
// launch installer
|
// launch installer
|
||||||
var installer = new InteractiveInstaller();
|
var installer = new InteractiveInstaller(bundleDir.FullName);
|
||||||
installer.Run(args);
|
installer.Run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +65,7 @@ namespace StardewModdingApi.Installer
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AssemblyName name = new AssemblyName(e.Name);
|
AssemblyName name = new AssemblyName(e.Name);
|
||||||
foreach (FileInfo dll in new DirectoryInfo(Program.DllSearchPath).EnumerateFiles("*.dll"))
|
foreach (FileInfo dll in new DirectoryInfo(Program.InternalFilesPath).EnumerateFiles("*.dll"))
|
||||||
{
|
{
|
||||||
if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.InvariantCultureIgnoreCase))
|
if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return Assembly.LoadFrom(dll.FullName);
|
return Assembly.LoadFrom(dll.FullName);
|
||||||
|
|
|
@ -16,7 +16,7 @@ SMAPI lets you run Stardew Valley with mods. Don't forget to download mods separ
|
||||||
|
|
||||||
Player's guide
|
Player's guide
|
||||||
--------------------------------
|
--------------------------------
|
||||||
See https://stardewvalleywiki.com/Modding:Player_Guide
|
See https://stardewvalleywiki.com/Modding:Player_Guide for help installing SMAPI, adding mods, etc.
|
||||||
|
|
||||||
|
|
||||||
Manual install
|
Manual install
|
||||||
|
@ -24,12 +24,11 @@ Manual install
|
||||||
THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead.
|
THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead.
|
||||||
If you really want to install SMAPI manually, here's how.
|
If you really want to install SMAPI manually, here's how.
|
||||||
|
|
||||||
1. Download the latest version of SMAPI: https://github.com/Pathoschild/SMAPI/releases
|
1. Unzip "internal/bundle.windows.zipped" (on Windows) or "internal/bundle.mono.zipped" (on
|
||||||
2. Unzip the .zip file somewhere (not in your game folder).
|
Linux/Mac). You can change '.zipped' to '.zip', it's just a normal zip file.
|
||||||
3. Copy the files from the "internal/Windows" folder (on Windows) or "internal/Mono" folder (on
|
2. Copy the files from the folder you just unzipped into your game folder. The
|
||||||
Linux/Mac) into your game folder. The `StardewModdingAPI.exe` file should be right next to the
|
`StardewModdingAPI.exe` file should be right next to the game's executable.
|
||||||
game's executable.
|
3.
|
||||||
4.
|
|
||||||
- Windows only: if you use Steam, see the install guide above to enable achievements and
|
- Windows only: if you use Steam, see the install guide above to enable achievements and
|
||||||
overlay. Otherwise, just run StardewModdingAPI.exe in your game folder to play with mods.
|
overlay. Otherwise, just run StardewModdingAPI.exe in your game folder to play with mods.
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\..\build\GlobalAssemblyInfo.cs">
|
<Compile Include="..\..\build\GlobalAssemblyInfo.cs">
|
||||||
|
|
|
@ -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 internal/Mono/install.exe
|
mono internal/install.exe
|
||||||
else
|
else
|
||||||
echo "Oops! Looks like Mono isn't installed. Please install Mono from https://mono-project.com, reboot, and run this installer again."
|
echo "Oops! Looks like Mono isn't installed. Please install Mono from https://mono-project.com, reboot, and run this installer again."
|
||||||
read
|
read
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
START /WAIT /B internal/Windows/install.exe
|
START /WAIT /B internal/install.exe
|
||||||
|
|
Loading…
Reference in New Issue