Where should my win32 program keep its files?

后端 未结 8 1500
时光取名叫无心
时光取名叫无心 2021-02-08 05:19

Our win32 applications (written in C++) have been around for over 10 years, and haven\'t been updated to follow \"good practices\" in terms of where they keep files. The applica

相关标签:
8条回答
  • 2021-02-08 06:05

    There are plenty of environment variables like: %USERPROFILE%, %HOMEPATH%, %APPDATA% all of these points to some user-specific directories, where you can put your user-specific files.

    For system-wide storage you can use %ALLUSERSPROFILE%, that is the place where you should put your read/write datafiles that are not specific to any user.

    0 讨论(0)
  • 2021-02-08 06:07

    Some guidelines are in this Knowledge Base article: How to write a Windows XP Application that stores user and application data in the correct location by using Visual C++. Also, if you search MSDN for Windows Logo Program you will find documentation regarding what an app needs to do to be truly compliant.

    SHGetKnownFolderPath can get you the directories you need. If backwards compatibility with XP and earlier is required, use the deprecated SHGetFolderPath

    Having said that, if you app came with documentation that said "everything used by this app is in this directory" I would love it ;)

    0 讨论(0)
提交回复
热议问题