diff options
| author | Jonathan Gray | 2004-12-15 12:30:58 +0000 |
|---|---|---|
| committer | Jonathan Gray | 2004-12-15 12:30:58 +0000 |
| commit | 2909c8fff6febf736ebddaf11fc5f40276cc3e5d (patch) | |
| tree | bab3f20f5495c933f55a6ab62349dfb6abc6b5f4 /base | |
| parent | 2bf74ffd35ff43c3e2f88d1f443791d2df770265 (diff) | |
| download | scummvm-rg350-2909c8fff6febf736ebddaf11fc5f40276cc3e5d.tar.gz scummvm-rg350-2909c8fff6febf736ebddaf11fc5f40276cc3e5d.tar.bz2 scummvm-rg350-2909c8fff6febf736ebddaf11fc5f40276cc3e5d.zip | |
- Move MAXPATHLEN includes/defines into common location
- Save files are now stored in $HOME/.scummvm/ by default if no other
save path is specified on non MacOS X unices.
svn-id: r16060
Diffstat (limited to 'base')
| -rw-r--r-- | base/gameDetector.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index 58a82630a8..d873f0da5f 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -36,6 +36,14 @@ #include "config.h" #endif +#ifdef UNIX +#include <sys/errno.h> +#include <sys/stat.h> +#ifndef MACOSX +#define DEFAULT_SAVE_PATH ".scummvm" +#endif +#endif + // DONT FIXME: DO NOT ORDER ALPHABETICALLY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :) #ifdef __PALM_OS__ static const char USAGE_STRING[] = "NoUsageString"; // save more data segment space @@ -99,6 +107,7 @@ static const char USAGE_STRING[] = ; #endif + GameDetector::GameDetector() { // Graphics @@ -152,6 +161,29 @@ GameDetector::GameDetector() { ConfMan.registerDefault("alsa_port", "65:0"); #endif +#ifdef DEFAULT_SAVE_PATH + char savePath[MAXPATHLEN]; +#ifdef UNIX + struct stat sb; + if (getenv("HOME") != NULL) { + snprintf(savePath, MAXPATHLEN, "%s/%s", getenv("HOME"), DEFAULT_SAVE_PATH); + if (stat(savePath, &sb) == -1) { + /* create the dir if it does not exist */ + if (errno == ENOENT) { + if (mkdir(savePath, 0755) != 0) { + perror("mkdir"); + exit(1); + } + } + } + /* check that we can the dir is there */ + if (stat(savePath, &sb) == 0) { + ConfMan.registerDefault("savepath", savePath); + } + } +#endif +#endif + _dumpScripts = false; memset(&_game, 0, sizeof(_game)); |
