1

How is it I get the 'Downloads' folder path?

I'm just not seeing it in the CSIDL's , I could append 'Downloads' to another value but 'Downloads' might not be that depending on the users language?

I'm seeing it in KNOWNFOLDERID (FOLDERID_Downloads) but that's Vista and above.

Shrek
  • 327
  • 5
  • 17
  • 1
    So it's in Vista and newer only as a defined entity, it doesn't have a CSIDL, because those are for the older versions of Windows. You should use the newer API e.g. `SHGetKnownFolderPath`, which uses folderids – Anya Shenanigans Mar 10 '15 at 12:39
  • The `KNOWNFOLDERID` documentation you linked clearly states that there is no `CSIDL` for it: *CSIDL Equivalent - None* and *Legacy Default Path - Not applicable*. – Ken White Mar 10 '15 at 12:50
  • You're reading of the documentation is correct. This folder is available from Vista up. – David Heffernan Mar 10 '15 at 12:54
  • Also checkout this implementation in Python: https://stackoverflow.com/questions/35851281/python-finding-the-users-downloads-folder – Rion DMello Mar 27 '20 at 04:34

1 Answers1

4

To get the Downloads folder, you have to be running on Vista or newer. The folder is not defined on older releases of Windows.

It doesn't have a CSIDL because it was created for use in the new SHGetKnownFolderPath API, not for use in the SHGetFolderPath API.

If you want to get the true folder, you have to use the new API. If you want to maintain some semblance of 'compatibility' on older releases of Windows, you can use the default value listed in the KNOWNFOLDERID page if the API is not available to you. You can use run-time linking to use the API to allow the application to run on the older release of Windows.

Under Remarks for SHGetKnownFolderPath, it does mention:

This function replaces SHGetFolderPath. That older function is now simply a wrapper for SHGetKnownFolderPath.

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
  • thanks, something must have created a 'Downloads' folder on my XP machine and it threw me lol. – Shrek Mar 10 '15 at 14:13