Fix user settings on Windows

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-10-21 14:57:03 +02:00
parent 2f558407c0
commit adfd296638
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
2 changed files with 10 additions and 2 deletions

View file

@ -818,9 +818,9 @@ std::string getSpecialPath(const SpecialPath type)
return {};
}
WCHAR path[MAX_PATH + 256];
WCHAR path[MAX_PATH] = {};
if (SHGetSpecialFolderPathW(nullptr, path, csidl, FALSE))
if (SHGetFolderPathW(nullptr, csidl, nullptr, SHGFP_TYPE_CURRENT, path) == S_OK)
return string::UTF16toUTF8(path);
return {};

View file

@ -518,6 +518,14 @@ public:
rack::system::removeRecursively(fAutosavePath);
#endif
#if ! DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
if (fInitializer->shouldSaveSettings)
{
INFO("Save settings");
rack::settings::save();
}
#endif
rack::contextSet(nullptr);
}