Made Win32 port use %USERPROFILE%\Stella as the base folder for the various

config files and the state folder.  This is more in line with the Linux and
OSX ports, which have a pre-defined basedir folder ($HOME/.stella).  This
also makes Stella behave better with limited accounts in Windows, since
writes are no longer done to the app folder.

Since the Win32 port didn't work this way before, many people may
require the old behaviour.  In this case, one may create a file named
'disable_profiles.txt' in the app folder to restore the old behaviour.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1424 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-03-09 17:52:40 +00:00
parent 8e499bcf59
commit 1d10a63af6
2 changed files with 26 additions and 9 deletions

View File

@ -13,7 +13,7 @@
## See the file "license" for information on usage and redistribution of
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
##
## $Id: Makefile,v 1.34 2008-03-09 15:30:27 stephena Exp $
## $Id: Makefile,v 1.35 2008-03-09 17:52:40 stephena Exp $
##
## Based on code from ScummVM - Scumm Interpreter
## Copyright (C) 2002-2004 The ScummVM project
@ -196,7 +196,7 @@ src/win32/stella_icon.o: src/win32/stella.ico src/win32/stella.rc
win32dist: stella$(EXEEXT)
rm -rf $(DISTNAME)
mkdir -p $(DISTNAME)/docs/graphics
$(STRIP) stella$(EXEEXT) -o $(DISTNAME)/stella$(EXEEXT)
$(STRIP) stella$(EXEEXT) -o $(DISTNAME)/Stella$(EXEEXT)
cp Announce.txt Changes.txt Copyright.txt License.txt README-SDL.txt Readme.txt Todo.txt $(DISTNAME)/docs
cp -r docs/*.html $(DISTNAME)/docs
cp -r docs/graphics/*.png $(DISTNAME)/docs/graphics

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystemWin32.cxx,v 1.21 2008-02-06 13:45:24 stephena Exp $
// $Id: OSystemWin32.cxx,v 1.22 2008-03-09 17:52:40 stephena Exp $
//============================================================================
#include <sstream>
@ -21,6 +21,7 @@
#include <windows.h>
#include "bspf.hxx"
#include "FSNode.hxx"
#include "OSystem.hxx"
#include "OSystemWin32.hxx"
@ -38,12 +39,28 @@
OSystemWin32::OSystemWin32()
: OSystem()
{
// TODO - there really should be code here to determine which version
// of Windows is being used.
// If using a version which supports multiple users (NT and above),
// the relevant directories should be created in per-user locations.
// For now, we just put it in the same directory as the executable.
const string& basedir = ".";
string basedir = ".";
if(!FilesystemNode::fileExists("disable_profiles.txt"))
{
OSVERSIONINFO win32OsVersion;
ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO));
win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&win32OsVersion);
// Check for non-9X version of Windows; Win9x will use the app directory
if(win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS)
{
// If this doesn't exist, we just fall back to the default (same directory as app)
char configFile[256];
if(GetEnvironmentVariable("USERPROFILE", configFile, sizeof(configFile)))
{
strcat(configFile, "\\Stella");
basedir = configFile;
}
}
}
setBaseDir(basedir);
setConfigFile(basedir + "\\stella.ini");
}