diff options
author | Simon Howard | 2009-03-08 23:46:09 +0000 |
---|---|---|
committer | Simon Howard | 2009-03-08 23:46:09 +0000 |
commit | f0c5cc898d993d3388dfbce5833e8ccca7b2f03f (patch) | |
tree | 4ba918a271e4ea0142170c28b53e35b6f9d506f3 /src/m_config.c | |
parent | 67fbcdce28b89b24f8fb27d5f25393ad775af719 (diff) | |
download | chocolate-doom-f0c5cc898d993d3388dfbce5833e8ccca7b2f03f.tar.gz chocolate-doom-f0c5cc898d993d3388dfbce5833e8ccca7b2f03f.tar.bz2 chocolate-doom-f0c5cc898d993d3388dfbce5833e8ccca7b2f03f.zip |
Fix -cdrom command line parameter to work with Heretic and Hexen;
compiles now work on Windows.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1452
Diffstat (limited to 'src/m_config.c')
-rw-r--r-- | src/m_config.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/src/m_config.c b/src/m_config.c index cfdf12a5..38ec8e00 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -1104,20 +1104,17 @@ void M_BindVariable(char *name, void *location) variable->bound = true; } -// -// SetConfigDir: -// -// Sets the location of the configuration directory, where configuration -// files are stored - default.cfg, chocolate-doom.cfg, savegames, etc. -// +// Get the path to the default configuration dir to use, if NULL +// is passed to M_SetConfigDir. -void M_SetConfigDir(void) +static char *GetDefaultConfigDir(void) { #ifndef _WIN32 - // Ignore the HOME environment variable on Windows - just behave - // like Vanilla Doom. + // On Unix systems we put configuration into ~/.chocolate-doom, but + // on Windows we just use the current directory, like Vanilla. char *homedir; + char *result; homedir = getenv("HOME"); @@ -1126,39 +1123,44 @@ void M_SetConfigDir(void) // put all configuration in a config directory off the // homedir - configdir = malloc(strlen(homedir) + strlen(PACKAGE_TARNAME) + 5); - - sprintf(configdir, "%s%c.%s%c", homedir, DIR_SEPARATOR, - PACKAGE_TARNAME, DIR_SEPARATOR); - - // make the directory if it doesnt already exist + result = malloc(strlen(homedir) + strlen(PACKAGE_TARNAME) + 5); - M_MakeDirectory(configdir); + sprintf(result, "%s%c.%s%c", homedir, DIR_SEPARATOR, + PACKAGE_TARNAME, DIR_SEPARATOR); } else #endif /* #ifndef _WIN32 */ { -#ifdef _WIN32 - //! - // @platform windows - // @vanilla - // - // Save configuration data and savegames in c:\doomdata, - // allowing play from CD. - // - - if (M_CheckParm("-cdrom") > 0) - { - printf(D_CDROM); - configdir = strdup("c:\\doomdata\\"); + // On Windows, we just use the current directory. - M_MakeDirectory(configdir); - } - else -#endif - { - configdir = strdup(""); - } + return strdup(""); + } +} + +// +// SetConfigDir: +// +// Sets the location of the configuration directory, where configuration +// files are stored - default.cfg, chocolate-doom.cfg, savegames, etc. +// + +void M_SetConfigDir(char *dir) +{ + // Use the directory that was passed, or find the default. + + if (dir != NULL) + { + configdir = dir; + } + else + { + configdir = GetDefaultConfigDir(); } + + printf("Using %s for configuration and saves\n", configdir); + + // Make the directory if it doesn't already exist: + + M_MakeDirectory(configdir); } |