mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-29 19:37:06 -05:00
Fixes root directory creation in Windows.
This commit is contained in:
parent
e8b2d359d6
commit
3768ac329c
3 changed files with 22 additions and 2 deletions
13
util.c
13
util.c
|
|
@ -687,9 +687,9 @@ int mkancestor(const char* file)
|
|||
{
|
||||
char dir[PATH_MAX];
|
||||
char* c;
|
||||
|
||||
|
||||
pathcpy(dir, sizeof(dir), file);
|
||||
|
||||
|
||||
c = strrchr(dir, '/');
|
||||
if (!c) {
|
||||
/* no ancestor */
|
||||
|
|
@ -699,11 +699,20 @@ int mkancestor(const char* file)
|
|||
/* clear the file */
|
||||
*c = 0;
|
||||
|
||||
/* if it's the root dir */
|
||||
if (*dir == 0) {
|
||||
/* nothing more to do */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
/* if it's a drive specificaion like "C:" */
|
||||
if (isalpha(dir[0]) && dir[1] == ':' && dir[2] == 0) {
|
||||
/* nothing more to do */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* try creating it */
|
||||
if (mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0) {
|
||||
/* just created */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue