diff options
author | nulltoken <emeric.fermas@gmail.com> | 2010-12-21 05:43:47 +0100 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2010-12-21 05:43:47 +0100 |
commit | 23a1edbd04250ac94071dae89d1d3014715e8112 (patch) | |
tree | bfb1bd1c0a7fd4edeec80bcc64f3be018285df38 | |
parent | f2d6a23aa6ed823b68d1a81c211044d581972aa3 (diff) | |
download | libgit2-23a1edbd04250ac94071dae89d1d3014715e8112.tar.gz |
Wrapped the detection of a Windows rooted path within a conditional compilation directive.
-rw-r--r-- | src/fileops.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/fileops.c b/src/fileops.c index c5cc73ef2..7a6ab731c 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -312,6 +312,19 @@ int gitfo_dirent( return GIT_SUCCESS; } +#ifdef GIT_WIN32 + +static int is_windows_rooted_path(const char* path) +{ + /* Does the root of the path look like a windows drive ? */ + if (isalpha(path[0]) && (path[1] == ':') && (path[2] == '/')) + return GIT_SUCCESS; + + return GIT_ERROR; +} + +#endif + int gitfo_mkdir_recurs(const char *path, int mode) { int error; @@ -324,9 +337,12 @@ int gitfo_mkdir_recurs(const char *path, int mode) error = GIT_SUCCESS; pp = path_copy; - /* Does the root of the path look like a windows drive ? */ - if (isalpha(pp[0]) && (pp[1] == ':') && (pp[2] == '/')) - pp += 2; +#ifdef GIT_WIN32 + + if (!is_windows_rooted_path(pp)) + pp += 2; /* Skip the drive name (eg. C: or D:) */ + +#endif while (error == GIT_SUCCESS && (sp = strchr(pp, '/')) != 0) { if (sp != pp && gitfo_isdir(path_copy) < GIT_SUCCESS) { |