using System.IO; namespace StardewModdingAPI { /// The base class for a mod. public class Mod { /********* ** Accessors *********/ /// The mod's manifest. public Manifest Manifest { get; internal set; } /// The full path to the mod's directory on the disk. public string PathOnDisk { get; internal set; } /// The full path to the mod's config.json file on the disk. public string BaseConfigPath => Path.Combine(this.PathOnDisk, "config.json"); /// The full path to the per-save configs folder (if is true). public string PerSaveConfigFolder => this.GetPerSaveConfigFolder(); /// The full path to the per-save configuration file for the current save (if is true). public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(this.PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; /********* ** Public methods *********/ /// The entry point for your mod. It will always be called once when the mod loads. public virtual void Entry(params object[] objects) { } /********* ** Private methods *********/ /// Get the full path to the per-save configuration file for the current save (if is true). private string GetPerSaveConfigFolder() { if (!this.Manifest.PerSaveConfigs) { Log.AsyncR($"The mod [{this.Manifest.Name}] is not configured to use per-save configs."); return ""; } return Path.Combine(this.PathOnDisk, "psconfigs"); } } }