From d31456fdc7cd55576523bc32ff8a7c2c18d66710 Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Tue, 22 Mar 2016 20:36:04 -0400 Subject: okay. things. --- StardewModdingAPI/Mod.cs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'StardewModdingAPI/Mod.cs') diff --git a/StardewModdingAPI/Mod.cs b/StardewModdingAPI/Mod.cs index fc86409b..b62a11c7 100644 --- a/StardewModdingAPI/Mod.cs +++ b/StardewModdingAPI/Mod.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.IO; namespace StardewModdingAPI { @@ -47,6 +44,23 @@ namespace StardewModdingAPI /// public string PathOnDisk { get; internal set; } + /// + /// A basic path to store your mod's config at. + /// + public string BaseConfigPath => PathOnDisk + "\\config.json"; + + /// + /// A basic path to where per-save configs are stored + /// + public string PerSaveConfigFolder => GetPerSaveConfigFolder(); + + /// + /// A basic path to store your mod's config at, dependent on the current save. + /// The Manifest must allow for per-save configs. This is to keep from having an + /// empty directory in every mod folder. + /// + public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; + /// /// A basic method that is the entry-point of your mod. It will always be called once when the mod loads. /// @@ -54,5 +68,15 @@ namespace StardewModdingAPI { } + + private string GetPerSaveConfigFolder() + { + if (Manifest.PerSaveConfigs) + { + return Path.Combine(PathOnDisk, "psconfigs"); + } + Log.Error("The mod [{0}] is not configured to use per-save configs.", Manifest.Name); + return ""; + } } } -- cgit