Use Saved Games shell folder instead of Documents/My Games for savegames
Posted: Wed Jan 02, 2019 1:50 pm
I noticed saved games are stored in the My Games subdirectory of the Documents shell folder.
On Windows, there is a dedicated shell folder for savegames.
Handling shell folders can be done using the registry:
https://superuser.com/a/1132321
Trying to use the 'Shell Folders' keys instead of the 'User Shell Folders' show a warning key message telling to preferablly use the SHGetFolderPath (before Windows Vista, https://msdn.microsoft.com/fr-fr/librar ... s.85).aspx) or SHGetKnownFolderPath (starting with Windows Vista, https://msdn.microsoft.com/fr-fr/librar ... s.85).aspx) functions.
Using the registry, it seems there is no human-form key to query. Using a list of known folder GUIDs (https://msdn.microsoft.com/en-us/librar ... s.85).aspx or https://docs.microsoft.com/en-us/dotnet ... tom-places), I ended up being able to quickly query the path for the correct location of that folder:
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v {4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}
It's probably better to use the Shell32.dll functions though, links to which are provided above.
On Windows, there is a dedicated shell folder for savegames.
Handling shell folders can be done using the registry:
https://superuser.com/a/1132321
Trying to use the 'Shell Folders' keys instead of the 'User Shell Folders' show a warning key message telling to preferablly use the SHGetFolderPath (before Windows Vista, https://msdn.microsoft.com/fr-fr/librar ... s.85).aspx) or SHGetKnownFolderPath (starting with Windows Vista, https://msdn.microsoft.com/fr-fr/librar ... s.85).aspx) functions.
Using the registry, it seems there is no human-form key to query. Using a list of known folder GUIDs (https://msdn.microsoft.com/en-us/librar ... s.85).aspx or https://docs.microsoft.com/en-us/dotnet ... tom-places), I ended up being able to quickly query the path for the correct location of that folder:
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v {4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}
It's probably better to use the Shell32.dll functions though, links to which are provided above.