using System.IO; namespace StardewModdingAPI.Installer.Framework { /// Manages paths for the SMAPI installer. internal class InstallerPaths { /********* ** Accessors *********/ /**** ** Main folders ****/ /// The directory path containing the files to copy into the game folder. public DirectoryInfo BundleDir { get; } /// The directory containing the installed game. public DirectoryInfo GameDir { get; } /// The directory into which to install mods. public DirectoryInfo ModsDir { get; } /**** ** Installer paths ****/ /// The full path to directory path containing the files to copy into the game folder. public string BundlePath => this.BundleDir.FullName; /// The full path to the backup API user settings folder, if applicable. public string BundleApiUserConfigPath { get; } /**** ** Game paths ****/ /// 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 SMAPI's internal configuration file. public string ApiConfigPath { get; } /// The full path to the user's config overrides file. public string ApiUserConfigPath { get; } /// The full path to the installed SMAPI executable file. public string ExecutablePath { get; } /// The full path to the vanilla game launcher on Linux/macOS. public string UnixLauncherPath { get; } /// The full path to the installed SMAPI launcher on Linux/macOS before it's renamed. public string UnixSmapiLauncherPath { get; } /// The full path to the vanilla game launcher on Linux/macOS after SMAPI is installed. public string UnixBackupLauncherPath { get; } /********* ** Public methods *********/ /// Construct an instance. /// The directory path containing the files to copy into the game folder. /// The directory path for the installed game. /// The name of the game's executable file for the current platform. public InstallerPaths(DirectoryInfo bundleDir, DirectoryInfo gameDir, string gameExecutableName) { this.BundleDir = bundleDir; this.GameDir = gameDir; this.ModsDir = new DirectoryInfo(Path.Combine(gameDir.FullName, "Mods")); this.BundleApiUserConfigPath = Path.Combine(bundleDir.FullName, "smapi-internal", "config.user.json"); 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"); this.ApiConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "config.json"); this.ApiUserConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "config.user.json"); } } }