From 53fa8e084ce1b677eca86b96727cc067656372b2 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 10 Oct 2008 18:01:50 +0000 Subject: Set SavePath correctly and create the directory if necessary. Subversion-branch: /branches/raven-branch Subversion-revision: 1350 --- src/hexen/h2_main.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src') 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 -- cgit v1.2.3