On Windows, it's not guaranteed that USERPROFILE is equivalent to %SYSTEMDRIVE%\Users\%USERNAME%. So it's possible that UserDefaults tries to write to a non-existent location, in which case it will never work. When this happens, all writes silently no-op.
This PR uses the Shell API SHGetKnownFolderPath to get the location of %LOCALAPPDATA% instead of manually building the path.
On Windows, it's not guaranteed that
USERPROFILE
is equivalent to%SYSTEMDRIVE%\Users\%USERNAME%
. So it's possible that UserDefaults tries to write to a non-existent location, in which case it will never work. When this happens, all writes silently no-op.This PR uses the Shell API
SHGetKnownFolderPath
to get the location of%LOCALAPPDATA%
instead of manually building the path.See documentation for this API:
Fixes #4997