diff options
Diffstat (limited to 'src/posix.c')
-rw-r--r-- | src/posix.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/posix.c b/src/posix.c index 61c79b071..1b85b053d 100644 --- a/src/posix.c +++ b/src/posix.c @@ -10,6 +10,8 @@ #include <stdio.h> #include <ctype.h> +#ifndef GIT_WIN32 + int p_open(const char *path, int flags) { return open(path, flags | O_BINARY); @@ -20,6 +22,25 @@ int p_creat(const char *path, int mode) return open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode); } +int p_getcwd(char *buffer_out, size_t size) +{ + char *cwd_buffer; + + assert(buffer_out && size > 0); + + cwd_buffer = getcwd(buffer_out, size); + + if (cwd_buffer == NULL) + return git__throw(GIT_EOSERR, "Failed to retrieve current working directory"); + + git_path_mkposix(buffer_out); + + git_path_join(buffer_out, buffer_out, ""); //Ensure the path ends with a trailing slash + return GIT_SUCCESS; +} + +#endif + int p_read(git_file fd, void *buf, size_t cnt) { char *b = buf; @@ -57,24 +78,3 @@ int p_write(git_file fd, const void *buf, size_t cnt) } return GIT_SUCCESS; } - -int p_getcwd(char *buffer_out, size_t size) -{ - char *cwd_buffer; - - assert(buffer_out && size > 0); - -#ifdef GIT_WIN32 - cwd_buffer = _getcwd(buffer_out, size); -#else - cwd_buffer = getcwd(buffer_out, size); -#endif - - if (cwd_buffer == NULL) - return git__throw(GIT_EOSERR, "Failed to retrieve current working directory"); - - git_path_mkposix(buffer_out); - - git_path_join(buffer_out, buffer_out, ""); //Ensure the path ends with a trailing slash - return GIT_SUCCESS; -} |