Special folder paths in configuration files
Posted: Fri Oct 30, 2009 12:08 pm
Hi,
I've got a configuration file for an application that needs to store a path. I can store a fixed path easily enough, such as "C:\foo\bar". However, I'd like to make it able to handle special paths. Easy enough for some things, as I can include a call to ExpandEnvironmentStrings_() so my paths can be written as "%systemdrive%\foo\bar".
However, the only user relative special folder path that seems to be exposed is %USERPROFILE% or %ALLUSERSPROFILE%. Ideally I'd like to be able to specify anything that changes with the OS or language (e.g. the desktop folder isn't always "%USERPROFILE%\Desktop" - or is it?), but there doesn't seem to be a standard way to do it. I don't want to have to add environment variables to the system, and I don't particularly want to have my own special environment variables that I parse first.
It also needs to look like a standard path if possible, something that you'd type on the command line.
Has anyone come across such a thing or am I going to have to go down the custom path string route?
Thanks.
I've got a configuration file for an application that needs to store a path. I can store a fixed path easily enough, such as "C:\foo\bar". However, I'd like to make it able to handle special paths. Easy enough for some things, as I can include a call to ExpandEnvironmentStrings_() so my paths can be written as "%systemdrive%\foo\bar".
However, the only user relative special folder path that seems to be exposed is %USERPROFILE% or %ALLUSERSPROFILE%. Ideally I'd like to be able to specify anything that changes with the OS or language (e.g. the desktop folder isn't always "%USERPROFILE%\Desktop" - or is it?), but there doesn't seem to be a standard way to do it. I don't want to have to add environment variables to the system, and I don't particularly want to have my own special environment variables that I parse first.
It also needs to look like a standard path if possible, something that you'd type on the command line.
Has anyone come across such a thing or am I going to have to go down the custom path string route?
Thanks.