From 0ef55c4b1e2aea60bc7281c31b9ca0dac70f272a Mon Sep 17 00:00:00 2001 From: Michał Dolaś Date: Mon, 9 Jan 2023 11:39:38 +0100 Subject: Mod-group specific config.json overriding --- src/SMAPI/Constants.cs | 3 +++ src/SMAPI/Framework/SCore.cs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index c5058e4b..3ff3159b 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -142,6 +142,9 @@ namespace StardewModdingAPI /// The file path for the overrides file for , which is applied over it. internal static string ApiUserConfigPath => Path.Combine(Constants.InternalFilesPath, "config.user.json"); + /// The mod-group-specific file path for the overrides file for , which is applied over it. + internal static string ApiModGroupConfigPath => Path.Combine(ModsPath, "config.json"); + /// The file path for the SMAPI metadata file. 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 c977ad65..fea0f7d0 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -197,6 +197,8 @@ namespace StardewModdingAPI.Framework this.Settings = JsonConvert.DeserializeObject(File.ReadAllText(Constants.ApiConfigPath)) ?? throw new InvalidOperationException("The 'smapi-internal/config.json' file is missing or invalid. You can reinstall SMAPI to fix this."); if (File.Exists(Constants.ApiUserConfigPath)) JsonConvert.PopulateObject(File.ReadAllText(Constants.ApiUserConfigPath), this.Settings); + if (File.Exists(Constants.ApiModGroupConfigPath)) + JsonConvert.PopulateObject(File.ReadAllText(Constants.ApiModGroupConfigPath), this.Settings); if (developerMode.HasValue) this.Settings.OverrideDeveloperMode(developerMode.Value); -- cgit