mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
- 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
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#if defined(UNIX)
|
||||
#include <sys/param.h>
|
||||
#ifdef MACOSX
|
||||
#define DEFAULT_CONFIG_FILE "Library/Preferences/ScummVM Preferences"
|
||||
#else
|
||||
@@ -35,10 +34,6 @@
|
||||
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 256
|
||||
#endif
|
||||
|
||||
#define MAXLINELEN 256
|
||||
|
||||
static char *ltrim(char *t) {
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
#if !defined(macintosh)
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#if !defined (__BEOS__)
|
||||
#include <unistd.h>
|
||||
@@ -119,4 +120,8 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 256
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user