summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2008-10-10 18:01:50 +0000
committerSimon Howard2008-10-10 18:01:50 +0000
commit53fa8e084ce1b677eca86b96727cc067656372b2 (patch)
treec2d1c9ea62bdae0b6c2d0e90899cc40d70bd13cf /src
parent0aa90653d8863faf347d8d75f3e721f42177937f (diff)
downloadchocolate-doom-53fa8e084ce1b677eca86b96727cc067656372b2.tar.gz
chocolate-doom-53fa8e084ce1b677eca86b96727cc067656372b2.tar.bz2
chocolate-doom-53fa8e084ce1b677eca86b96727cc067656372b2.zip
Set SavePath correctly and create the directory if necessary.
Subversion-branch: /branches/raven-branch Subversion-revision: 1350
Diffstat (limited to 'src')
-rw-r--r--src/hexen/h2_main.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index aadf647c..6fc85dc7 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -39,6 +39,7 @@
#include "ct_chat.h"
#include "d_iwad.h"
#include "d_mode.h"
+#include "m_misc.h"
#include "s_sound.h"
#include "i_system.h"
#include "m_argv.h"
@@ -180,6 +181,14 @@ void D_BindVariables(void)
}
}
+// Set the default directory where hub savegames are saved.
+
+static void D_SetDefaultSavePath(void)
+{
+ SavePath = malloc(strlen(configdir) + 10);
+ sprintf(SavePath, "%shexndata%c", configdir, DIR_SEPARATOR);
+}
+
//
// D_GrabMouseCallback
//
@@ -226,6 +235,7 @@ void D_DoomMain(void)
ST_Message("M_LoadDefaults: Load system defaults.\n");
D_BindVariables();
M_SetConfigDir();
+ D_SetDefaultSavePath();
M_SetConfigFilenames("hexen.cfg", PROGRAM_PREFIX "hexen.cfg");
M_LoadDefaults();
@@ -858,21 +868,7 @@ void CleanExit(void)
static void CreateSavePath(void)
{
- char creationPath[121];
- int len;
-
- if (cdrom == true)
- {
- SavePath = "c:\\hexndata\\";
- }
- len = strlen(SavePath);
- if (len >= 120)
- I_Error("Save path too long\n");
- strcpy(creationPath, SavePath);
-#ifdef __WATCOMC__
- creationPath[len - 1] = 0;
- mkdir(creationPath);
-#endif
+ M_MakeDirectory(SavePath);
}
#ifdef TIMEBOMB