Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for loading user config file #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Karandra
Copy link

@Karandra Karandra commented Jan 9, 2019

Fix for SettingStore::LoadUserSettings. Uses plugin file name as modName for ReadINI function instead of use INI file name.

Some user reported that MCM doesn't read used config file when name of the config file doesn't exactly
match to name of plugin file. That is, when file names differ only in character case, MCM will not read user config. Proposed change searches for all plugin files and if there is user config file for this plugin, calls SettingStore::ReadINI with plugin file name as modName argument to ReadINI and not with user INI file.

New loader code is written using some C++17 features, but can be easily rewritten to compile with older versions.

Sorry, seems like GitHub converted line endings in .cpp file.

Uses plugin file name as 'modName' for 'ReadINI' function instead of use INI file name.
@Karandra
Copy link
Author

Karandra commented Jan 9, 2019

Seems like your AppVeyor don't support C++17.

@Karandra
Copy link
Author

Karandra commented Jan 12, 2019

I've changed search location from Data folder using plugin file name to Data\MCM\Config using mod folder name as modName. This way modName should match the name defined in config.json file even if plugin file name doesn't.

However, there are some mods that breaks the rule "folder name (in Data\MCM\Config)" should match the name defined in config.json, "FO4 Difficulty Setting" for example. Though FO4 Difficulty Setting doesn't use MCM config file to store its config so that's not an really an issue for this mod.

@Karandra
Copy link
Author

Changed SettingStore::m_settingStore hasher and comparison to be case-insensitive, also m_settingStore now stores Setting object as std::unique_ptr and not as raw pointer to avoid memory leak in SettingStore::RegisterModSetting on replacing existing setting with new one (line 281).

You may need to manually add StringUtil.h file to the VS project because commit doesn't include changed .vcxproj file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant