Fix for MS Windwos when a path contains a drive letter.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@530 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+6
-3
@@ -45,7 +45,8 @@ prepareConfigDir (void) {
|
|||||||
configDir = realloc (configDir, strlen (configDir) + 1);
|
configDir = realloc (configDir, strlen (configDir) + 1);
|
||||||
|
|
||||||
// Create the path upto the config dir, if not already existing.
|
// Create the path upto the config dir, if not already existing.
|
||||||
mkdirhier (configDir);
|
if (mkdirhier (configDir) == -1)
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -61,7 +62,8 @@ prepareSaveDir (void) {
|
|||||||
saveDir = realloc (saveDir, strlen (saveDir) + 1);
|
saveDir = realloc (saveDir, strlen (saveDir) + 1);
|
||||||
|
|
||||||
// Create the path upto the save dir, if not already existing.
|
// Create the path upto the save dir, if not already existing.
|
||||||
mkdirhier (saveDir);
|
if (mkdirhier (saveDir) == -1)
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
//#ifdef DEBUG
|
//#ifdef DEBUG
|
||||||
fprintf(stderr, "Saved games are kept in %s.\n", saveDir);
|
fprintf(stderr, "Saved games are kept in %s.\n", saveDir);
|
||||||
//#endif
|
//#endif
|
||||||
@@ -80,6 +82,7 @@ prepareMeleeDir (void) {
|
|||||||
meleeDir = realloc (meleeDir, strlen (meleeDir) + 1);
|
meleeDir = realloc (meleeDir, strlen (meleeDir) + 1);
|
||||||
|
|
||||||
// Create the path upto the save dir, if not already existing.
|
// Create the path upto the save dir, if not already existing.
|
||||||
mkdirhier (meleeDir);
|
if (mkdirhier (meleeDir) == -1)
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,15 @@ mkdirhier (const char *path)
|
|||||||
ptr = buf;
|
ptr = buf;
|
||||||
pathstart = path;
|
pathstart = path;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
// driveletter + semicolon on Windows.
|
||||||
|
if (isalpha(pathstart[0]) && pathstart[1] == ':')
|
||||||
|
{
|
||||||
|
*(ptr++) = *(pathstart++);
|
||||||
|
*(ptr++) = *(pathstart++);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (*pathstart == '/') {
|
if (*pathstart == '/') {
|
||||||
*ptr = '/';
|
*ptr = '/';
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|||||||
Reference in New Issue
Block a user