From 429fe471d9f945a6f56e6b65f66a7c4400aba602 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Tue, 29 Jan 2002 00:08:13 +0000 Subject: [PATCH] Added d_mkdir macro --- include/d_io.h | 6 ++++++ main/inferno.c | 13 ++++++++----- main/newdemo.c | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/d_io.h b/include/d_io.h index cf1e56da..91cb938a 100644 --- a/include/d_io.h +++ b/include/d_io.h @@ -17,4 +17,10 @@ void removeext(const char *filename, char *out); unsigned long GetDiskFree(); +#if defined(__WINDOWS__) || defined(__MINGW32__) +#define d_mkdir(path) mkdir(path) +#else +#define d_mkdir(path) mkdir(path, 0755) +#endif + #endif diff --git a/main/inferno.c b/main/inferno.c index 9bd6fe3f..9376bfb0 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * $Source: /cvs/cvsroot/d2x/main/inferno.c,v $ - * $Revision: 1.20 $ + * $Revision: 1.21 $ * $Author: bradleyb $ - * $Date: 2002-01-28 00:03:47 $ + * $Date: 2002-01-29 00:08:13 $ * * FIXME: put description here * * $Log: not supported by cvs2svn $ + * Revision 1.20 2002/01/28 00:03:47 bradleyb + * Data files now go in DATADIR/games/d2x, user files now go in ~/.d2x + * * Revision 1.19 2002/01/18 07:01:37 bradleyb * allow -h for help * @@ -135,6 +138,7 @@ char copyright[] = "DESCENT II COPYRIGHT (C) 1994-1996 PARALLAX SOFTWARE CORPOR #include "mission.h" #include "movie.h" #include "compbit.h" +#include "d_io.h" // # include "3dfx_des.h" @@ -149,7 +153,6 @@ extern int Current_display_mode; //$$ there's got to be a better way than #include "editor/editor.h" #include "editor/kdefs.h" #include "ui.h" -#include "d_io.h" #endif #ifdef SDL_INPUT @@ -524,9 +527,9 @@ int main(int argc,char **argv) strcpy(buf, home); strcat(buf, "/.d2x"); if (chdir(buf)) { - mkdir(buf, 0755); + d_mkdir(buf); if (chdir(buf)) - fprintf(stderr, "Cannot change to ~/.d2x\n"); + fprintf(stderr, "Cannot change to $HOME/.d2x\n"); } } } diff --git a/main/newdemo.c b/main/newdemo.c index 753c0792..6ca68dc4 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -2960,7 +2960,7 @@ void newdemo_start_recording() #else if (outfile == NULL) { //dir doesn't exist and no errno on mac! #endif - mkdir(DEMO_DIR, 0755); //try making directory + d_mkdir(DEMO_DIR); //try making directory outfile = fopen( DEMO_FILENAME, "wb" ); } -- 2.39.2