Jump to content
  • Advertisement
Sign in to follow this  
Lode

[win32] Why would anyone use KNOWNFOLDERID?

This topic is 3215 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

On Windows, there's a standardized way to get common folders like appdata for users and global appdata. This used to work with "CSIDL" (http://msdn.microsoft.com/en-us/library/bb762494%28VS.85%29.aspx). But now it's noted there that the system is deprecated and on Vista, it uses "KNOWNFOLDERID" (http://msdn.microsoft.com/en-us/library/bb762584%28VS.85%29.aspx) instead. But when using that, it probably won't work on XP or lower anymore because these don't know the concept of "KNOWNFOLDERID". So the whole point of having standardized folder names that work on any version of Windows, is lost... Normally I find nothing wrong with adding new features to an API and deprecating old ones, but AFAIK this particular feature is exactly there for compatibility between Windows versions, namely using this as opposed to hardcoding the path as "C:\Documents and Settings\...". Why would anyone use "KNOWNFOLDERID" unless you're writing an application that works ONLY on Vista and higher?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Lode
Why would anyone use "KNOWNFOLDERID" unless you're writing an application that works ONLY on Vista and higher?


You can always put an if statement into there.

Over time however, support for old systems gets abandoned, just like applications stopped supporting 95/98, and 2000.

As for old applications - that's what VMs are for. It's the age old compromise between backwards compatibility and progress. Vista and 7 have changed a lot of core concepts.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lode
Why would anyone use "KNOWNFOLDERID" unless you're writing an application that works ONLY on Vista and higher?


I guess you wouldn't...
The docs for SHGetFolderLocation says the following:
Quote:

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


So if you target older systems then use the old method, as Vista will retain compatibility with it and won't just have apps stop working. When you start targeting only Vista and later, use the new one.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!