From 9029633f7f1076415fcb9e76fd3e0e58357ddcec Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 11 Aug 2018 23:17:36 -0400 Subject: overhaul installer display (#554) The installer now validates preconditions earlier when possible, and after each step will reset the text and condense details from previous steps. This way players only see info for the current question to avoid confusion, and it's easier to add new steps. --- src/SMAPI.Installer/Framework/InstallerPaths.cs | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/SMAPI.Installer/Framework/InstallerPaths.cs (limited to 'src/SMAPI.Installer/Framework/InstallerPaths.cs') diff --git a/src/SMAPI.Installer/Framework/InstallerPaths.cs b/src/SMAPI.Installer/Framework/InstallerPaths.cs new file mode 100644 index 00000000..d212876a --- /dev/null +++ b/src/SMAPI.Installer/Framework/InstallerPaths.cs @@ -0,0 +1,61 @@ +using System.IO; + +namespace StardewModdingAPI.Installer.Framework +{ + /// Manages paths for the SMAPI installer. + internal class InstallerPaths + { + /********* + ** Accessors + *********/ + /// The directory containing the installer files for the current platform. + public DirectoryInfo PackageDir { get; } + + /// The directory containing the installed game. + public DirectoryInfo GameDir { get; } + + /// The directory into which to install mods. + public DirectoryInfo ModsDir { get; } + + /// The full path to the directory containing the installer files for the current platform. + public string PackagePath => this.PackageDir.FullName; + + /// The full path to the directory containing the installed game. + public string GamePath => this.GameDir.FullName; + + /// The full path to the directory into which to install mods. + public string ModsPath => this.ModsDir.FullName; + + /// The full path to the installed SMAPI executable file. + public string ExecutablePath { get; } + + /// The full path to the vanilla game launcher on Linux/Mac. + public string UnixLauncherPath { get; } + + /// The full path to the installed SMAPI launcher on Linux/Mac before it's renamed. + public string UnixSmapiLauncherPath { get; } + + /// The full path to the vanilla game launcher on Linux/Mac after SMAPI is installed. + public string UnixBackupLauncherPath { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The directory path containing the installer files for the current platform. + /// The directory path for the installed game. + /// The name of the game's executable file for the current platform. + public InstallerPaths(DirectoryInfo packageDir, DirectoryInfo gameDir, string gameExecutableName) + { + this.PackageDir = packageDir; + this.GameDir = gameDir; + this.ModsDir = new DirectoryInfo(Path.Combine(gameDir.FullName, "Mods")); + + this.ExecutablePath = Path.Combine(gameDir.FullName, gameExecutableName); + this.UnixLauncherPath = Path.Combine(gameDir.FullName, "StardewValley"); + this.UnixSmapiLauncherPath = Path.Combine(gameDir.FullName, "StardewModdingAPI"); + this.UnixBackupLauncherPath = Path.Combine(gameDir.FullName, "StardewValley-original"); + } + } +} -- cgit