summaryrefslogtreecommitdiff
path: root/src/SMAPI.Installer/Framework/InstallerPaths.cs
blob: d212876a0613e0bf3e1d5cd81744799335cec9b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.IO;

namespace StardewModdingAPI.Installer.Framework
{
    /// <summary>Manages paths for the SMAPI installer.</summary>
    internal class InstallerPaths
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The directory containing the installer files for the current platform.</summary>
        public DirectoryInfo PackageDir { get; }

        /// <summary>The directory containing the installed game.</summary>
        public DirectoryInfo GameDir { get; }

        /// <summary>The directory into which to install mods.</summary>
        public DirectoryInfo ModsDir { get; }

        /// <summary>The full path to the directory containing the installer files for the current platform.</summary>
        public string PackagePath => this.PackageDir.FullName;

        /// <summary>The full path to the directory containing the installed game.</summary>
        public string GamePath => this.GameDir.FullName;

        /// <summary>The full path to the directory into which to install mods.</summary>
        public string ModsPath => this.ModsDir.FullName;

        /// <summary>The full path to the installed SMAPI executable file.</summary>
        public string ExecutablePath { get; }

        /// <summary>The full path to the vanilla game launcher on Linux/Mac.</summary>
        public string UnixLauncherPath { get; }

        /// <summary>The full path to the installed SMAPI launcher on Linux/Mac before it's renamed.</summary>
        public string UnixSmapiLauncherPath { get; }

        /// <summary>The full path to the vanilla game launcher on Linux/Mac after SMAPI is installed.</summary>
        public string UnixBackupLauncherPath { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="packageDir">The directory path containing the installer files for the current platform.</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>
        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");
        }
    }
}