Jon A. Cruz wrote:
On May 6, 2006, at 1:40 AM, Jasper van de Gronde wrote:
BTW, was there a specific reason for choosing these directories? At least on Windows it might make more sense to save it to the "My Documents" directory (or something similar), as the current location (the user's "home" directory) isn't exactly a well-known directory on Windows (most users probably don't even know where it is and certainly don't expect to ever have to look there).
"My Documents" takes jumping through lots of COM hoops, and is different on earlier versions of Windows. The other code was already around for Unix/Linux support.
So it's basically just what was simplest early on to implement.
How about using SHGetSpecialFolderPath? Should work on pretty much any Windows system and is reasonably easy to use.
Example usage (prints the location of the My Documents directory for the current user): #define _WIN32_IE 0x0400 #include <shlobj.h> #include <stdio.h>
int main() { char path[MAX_PATH+1]; SHGetSpecialFolderPath(NULL, path, CSIDL_PERSONAL, 0); printf("My docs: %s\n", path); return 0; }