File tree Expand file tree Collapse file tree 3 files changed +25
-12
lines changed
Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change 138138 mkdir (name , 0755 );
139139 }
140140
141+ void getConfigPathPrefix (char * dest ) {
142+ strcpy (dest , getenv ("HOME" ));
143+ strcat (dest , "/.jddev0" );
144+ makeDirectory (dest );
145+ strcat (dest , "/ConsoleSokoban" );
146+ makeDirectory (dest );
147+ strcat (dest , "/" );
148+ }
149+
141150 void sleepMS (unsigned int time ) {
142151 usleep (time * 1000 );
143152 }
374383 _mkdir (name );
375384 }
376385
386+ void getConfigPathPrefix (char * dest ) {
387+ strcpy (dest , getenv ("HOMEDRIVE" ));
388+ strcat (dest , getenv ("HOMEPATH" ));
389+ strcat (dest , "/.jddev0" );
390+ makeDirectory (dest );
391+ strcat (dest , "/ConsoleSokoban" );
392+ makeDirectory (dest );
393+ strcat (dest , "/" );
394+ }
395+
377396 void sleepMS (unsigned int time ) {
378397 Sleep (time );
379398 }
Original file line number Diff line number Diff line change 22#define CONSOLE_LIB_H
33 #define CONSOLE_LIB_VER "v0.0.1"
44
5+ #define CONFIG_PATH_FOLDER "ConsoleSokoban"
6+
57 //Keys
68 //Arrow keys
79 #define CL_KEY_LEFT 5000
4143
4244 void makeDirectory (const char * name );
4345
46+ void getConfigPathPrefix (char * dest );
47+
4448 void sleepMS (unsigned int time );
4549
4650 void drawf (const char * restrict format , ...);
Original file line number Diff line number Diff line change @@ -1076,12 +1076,7 @@ void readLevelData(void) {
10761076 levelCount = 0 ;
10771077 }
10781078
1079- strcpy (pathMapSaveData , getenv ("HOME" ));
1080- strcat (pathMapSaveData , "/.jddev0" );
1081- makeDirectory (pathMapSaveData );
1082- strcat (pathMapSaveData , "/ConsoleSokoban" );
1083- makeDirectory (pathMapSaveData );
1084- strcat (pathMapSaveData , "/" );
1079+ getConfigPathPrefix (pathMapSaveData );
10851080
10861081 char mapData [65536 ];
10871082 int mapDataByteOffset = 0 ;
@@ -1254,12 +1249,7 @@ void updateLevelPackStats(int levelPackIndex) {
12541249
12551250 int levelCountTmp = 100 ;
12561251
1257- strcpy (pathMapSaveData , getenv ("HOME" ));
1258- strcat (pathMapSaveData , "/.jddev0" );
1259- makeDirectory (pathMapSaveData );
1260- strcat (pathMapSaveData , "/ConsoleSokoban" );
1261- makeDirectory (pathMapSaveData );
1262- strcat (pathMapSaveData , "/" );
1252+ getConfigPathPrefix (pathMapSaveData );
12631253
12641254 if (strlen (build_in_map_prefix ) <= strlen (pathMapData [currentMapIndex ]) &&
12651255 memcmp (build_in_map_prefix , pathMapData [currentMapIndex ], strlen (build_in_map_prefix )) == 0 ) {
You can’t perform that action at this time.
0 commit comments