What's a decent algorithm for discovering the Windows home directory? I'm trying to figure some stuff out for NAGI but I want to be able to find the Windows equivalent of the unix directories
.../game <-- this will be passed to NAGI, easy
~/ <-- documents and settings? what if it's changed.. what about windows 95?
/etc <-- documents and settings? this is for more global settings though.
.../nagi <-- nagi will know this. these would store default settings.
Any suggestions? I need a decent system that will work for Win 95, 98, ME, NT, 2k, XP.. etc etc Would I be correct in assuming for later versions of windows I can use the enviroment settings but earlier versions I need to fudge something togeher?
- Nick
Windows Home Directory
Re:Windows Home Directory
just abstract an interface out for it.
on win32 you have standard api calls for things likle WinGetSystemDirectory, WinGetWindowsDirectory, WinGetTempFileAndPath (handy!).
on unix you have to manually parse ~, its not done on the system level.
also remember the 'My Documents/Documents and Settings' are special folders whose locations can change (reg entries). best bet is to use the environment vars for this.
those folders was all different between 95/95, nt4, 2k+xp. so you have 3 different locations (if user didnt change location in registry). also 95/98 doesnt have a concepct of multiuser so....
on win32 you have standard api calls for things likle WinGetSystemDirectory, WinGetWindowsDirectory, WinGetTempFileAndPath (handy!).
on unix you have to manually parse ~, its not done on the system level.
also remember the 'My Documents/Documents and Settings' are special folders whose locations can change (reg entries). best bet is to use the environment vars for this.
those folders was all different between 95/95, nt4, 2k+xp. so you have 3 different locations (if user didnt change location in registry). also 95/98 doesnt have a concepct of multiuser so....
-- Stu --
Re:Windows Home Directory
Actually, even with Windows 95, you can have multiple profiles.. i might have to google harder.
- Nick
- Nick
Re:Windows Home Directory
On current versions of Windows (2000 and XP), this is easily resolved. On previous versions a little guesswork is involved.
SHGetSpecialFolderLocation, SHGetFolderLocation and SHGetSpecialFolderPath can be used with various path constants. On current Windows you can query for the location of the CSIDL_COMMON_APPDATA and CSIDL_APPDATA folders, which should be used for application data for all users and for the current user respectively. CSIDL_APPDATA is probably the closest you'll have to a ~ directory on Windows, but it's not supported on a system that doesn't have the desktop update installed (i.e. Windows 95 and NT 4).
SHGetSpecialFolderLocation, SHGetFolderLocation and SHGetSpecialFolderPath can be used with various path constants. On current Windows you can query for the location of the CSIDL_COMMON_APPDATA and CSIDL_APPDATA folders, which should be used for application data for all users and for the current user respectively. CSIDL_APPDATA is probably the closest you'll have to a ~ directory on Windows, but it's not supported on a system that doesn't have the desktop update installed (i.e. Windows 95 and NT 4).
Re:Windows Home Directory
Anyone had much experience with this library?
http://www.maccormack.net/~djm/fnkdat/
seems to be able to do most of this stuff.
- Nick
http://www.maccormack.net/~djm/fnkdat/
seems to be able to do most of this stuff.
- Nick