ref: 53fa8e084ce1b677eca86b96727cc067656372b2
parent: 0aa90653d8863faf347d8d75f3e721f42177937f
author: Simon Howard <[email protected]>
date: Fri Oct 10 14:01:50 EDT 2008
Set SavePath correctly and create the directory if necessary. Subversion-branch: /branches/raven-branch Subversion-revision: 1350
--- 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 @@
}
}
+// 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 @@
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 @@
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