mattiasgustavsson/libs

App.h using deprecated Windows APIs to find known folders

kavika13 opened this issue · 2 comments

From MSDN docs on the API and enum values used:

Note As of Windows Vista, this function is merely a wrapper for SHGetKnownFolderPath. The CSIDL value is translated to its associated KNOWNFOLDERID and then SHGetKnownFolderPath is called. New applications should use the known folder system rather than the older CSIDL system, which is supported only for backward compatibility.


[!Note]As of Windows Vista, these values have been replaced by KNOWNFOLDERID values. See that topic for a list of the new constants and their corresponding CSIDL values. For convenience, corresponding KNOWNFOLDERID values are also noted here for each CSIDL value.

The CSIDL system is supported under Windows Vista for compatibility reasons. However, new development should use KNOWNFOLDERID values rather than CSIDL values.

It might be sense to include this API flag, but hide it behind something like a APP_XP_COMPAT compiler define, so people can use these deprecated functions only if XP compatibility is desired.

Here's the new API that should supposedly be used instead:

Have you built it using Visual Studio 2019 + WIN10 PRO?

This has been changed to only use ShGetFolderPathA if it exists, so it doesn't fail to compile or crash. I might change to use SHGetKnownFolderPath, but I am considering removing the app_userdata/app_appdata functions altogether, and haven't decided yet