summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-01-25 18:22:50 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-01-25 18:22:50 -0500
commitfc0b98be4584eec2b06a3af09cc4b85f9e9a9efc (patch)
tree4a469ca6cbefb5724580ca8ea2cbee8823428bfa /src
parent7a6dab7548e7bc32a685e916edec83f6458881c1 (diff)
downloadSMAPI-fc0b98be4584eec2b06a3af09cc4b85f9e9a9efc.tar.gz
SMAPI-fc0b98be4584eec2b06a3af09cc4b85f9e9a9efc.tar.bz2
SMAPI-fc0b98be4584eec2b06a3af09cc4b85f9e9a9efc.zip
add user settings that override defaults (#693)
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Constants.cs3
-rw-r--r--src/SMAPI/Framework/SCore.cs3
-rw-r--r--src/SMAPI/SMAPI.config.json6
3 files changed, 12 insertions, 0 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs
index da2ee375..d2af5de2 100644
--- a/src/SMAPI/Constants.cs
+++ b/src/SMAPI/Constants.cs
@@ -61,6 +61,9 @@ namespace StardewModdingAPI
/// <summary>The file path for the SMAPI configuration file.</summary>
internal static string ApiConfigPath => Path.Combine(Constants.InternalFilesPath, "config.json");
+ /// <summary>The file path for the overrides file for <see cref="ApiConfigPath"/>, which is applied over it.</summary>
+ internal static string ApiUserConfigPath => Path.Combine(Constants.InternalFilesPath, "config.user.json");
+
/// <summary>The file path for the SMAPI metadata file.</summary>
internal static string ApiMetadataPath => Path.Combine(Constants.InternalFilesPath, "metadata.json");
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index d71b5e5a..81b7c2e8 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -153,6 +153,9 @@ namespace StardewModdingAPI.Framework
// init basics
this.Settings = JsonConvert.DeserializeObject<SConfig>(File.ReadAllText(Constants.ApiConfigPath));
+ if (File.Exists(Constants.ApiUserConfigPath))
+ JsonConvert.PopulateObject(File.ReadAllText(Constants.ApiUserConfigPath), this.Settings);
+
this.LogFile = new LogFileManager(logPath);
this.Monitor = new Monitor("SMAPI", this.ConsoleManager, this.LogFile, this.Settings.ConsoleColors, this.Settings.VerboseLogging)
{
diff --git a/src/SMAPI/SMAPI.config.json b/src/SMAPI/SMAPI.config.json
index 824bb783..57b4f885 100644
--- a/src/SMAPI/SMAPI.config.json
+++ b/src/SMAPI/SMAPI.config.json
@@ -6,6 +6,12 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
The default values are mirrored in StardewModdingAPI.Framework.Models.SConfig to log custom changes.
+This file is overwritten each time you update or reinstall SMAPI. To avoid losing custom settings,
+create a 'config.user.json' file in the same folder with *only* the settings you want to change.
+That file won't be overwritten, and any settings in it will override the default options. Don't
+copy all the settings, or you may cause bugs due to overridden changes in future SMAPI versions.
+
+
*/
{