diff options
author | Zoryn <Zoryn4163@users.noreply.github.com> | 2016-03-22 20:58:00 -0400 |
---|---|---|
committer | Zoryn <Zoryn4163@users.noreply.github.com> | 2016-03-22 20:58:00 -0400 |
commit | 7076886f2c229db8c06f41dd29aa0bf7ac966dc2 (patch) | |
tree | b73219bf01b6afc25dbe26b761e5d4acc28773dd /StardewModdingAPI/Mod.cs | |
parent | 07773a380428c7b37f729e3b32fd7e7b960b360d (diff) | |
parent | 24e144d0f1aaae33fb51e80031259d0119acff7c (diff) | |
download | SMAPI-7076886f2c229db8c06f41dd29aa0bf7ac966dc2.tar.gz SMAPI-7076886f2c229db8c06f41dd29aa0bf7ac966dc2.tar.bz2 SMAPI-7076886f2c229db8c06f41dd29aa0bf7ac966dc2.zip |
Merge pull request #50 from Zoryn4163/master
a lot
Diffstat (limited to 'StardewModdingAPI/Mod.cs')
-rw-r--r-- | StardewModdingAPI/Mod.cs | 32 |
1 files changed, 28 insertions, 4 deletions
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 { @@ -48,11 +45,38 @@ namespace StardewModdingAPI public string PathOnDisk { get; internal set; } /// <summary> + /// A basic path to store your mod's config at. + /// </summary> + public string BaseConfigPath => PathOnDisk + "\\config.json"; + + /// <summary> + /// A basic path to where per-save configs are stored + /// </summary> + public string PerSaveConfigFolder => GetPerSaveConfigFolder(); + + /// <summary> + /// 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. + /// </summary> + public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; + + /// <summary> /// A basic method that is the entry-point of your mod. It will always be called once when the mod loads. /// </summary> public virtual void Entry(params object[] objects) { } + + 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 ""; + } } } |