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 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 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"); this.ApiConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "StardewModdingAPI.config.json"); } } }