Upon advice from Eckhard, changed the default location of the Stella

config folder to "My Documents\Stella".  Note that 'My Documents' will
mean different locations in different versions of Windows.  But the
user shouldn't have to worry about that, since the 'Stella' folder will
be in whatever 'My Documents' is on your system :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1425 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-03-09 20:38:44 +00:00
parent 1d10a63af6
commit cb0b5ae1ee
1 changed files with 17 additions and 14 deletions

View File

@ -13,12 +13,13 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OSystemWin32.cxx,v 1.22 2008-03-09 17:52:40 stephena Exp $ // $Id: OSystemWin32.cxx,v 1.23 2008-03-09 20:38:44 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <windows.h> #include <windows.h>
#include <shlobj.h>
#include "bspf.hxx" #include "bspf.hxx"
#include "FSNode.hxx" #include "FSNode.hxx"
@ -43,21 +44,23 @@ OSystemWin32::OSystemWin32()
if(!FilesystemNode::fileExists("disable_profiles.txt")) if(!FilesystemNode::fileExists("disable_profiles.txt"))
{ {
OSVERSIONINFO win32OsVersion; /*
ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO)); Use 'My Documents' folder for the Stella folder, which can be in many
win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); different places depending on the version of Windows, as follows:
GetVersionEx(&win32OsVersion);
// Check for non-9X version of Windows; Win9x will use the app directory 98: C:\My Documents
if(win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) XP: C:\Document and Settings\USERNAME\My Documents\
Vista: C:\Users\USERNAME\Documents\
This function is guaranteed to return a valid 'My Documents'
folder (as much as Windows *can* make that guarantee)
*/
char configPath[256];
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE,
NULL, 0, configPath)))
{ {
// If this doesn't exist, we just fall back to the default (same directory as app) strcat(configPath, "\\Stella");
char configFile[256]; basedir = configPath;
if(GetEnvironmentVariable("USERPROFILE", configFile, sizeof(configFile)))
{
strcat(configFile, "\\Stella");
basedir = configFile;
}
} }
} }