using System.IO; namespace StardewModdingAPI.Installer.Framework { /// Manages paths for the SMAPI installer. internal class InstallerPaths { /********* ** Accessors *********/ /// 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; } /// 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 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 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 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.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"); } } }