diff options
| author | Paul Betts <paul@paulbetts.org> | 2011-09-19 12:36:12 -0700 |
|---|---|---|
| committer | Paul Betts <paul@paulbetts.org> | 2011-09-19 13:14:04 -0700 |
| commit | 7998ae5ab1d7a37860e10cdb34b3da1532b6efb0 (patch) | |
| tree | 68e89633c2be37b5f54b9deba435f3993344c7cf /src/posix.c | |
| parent | c498701df7700695e287ea0e2f08062f9147b3a6 (diff) | |
| download | libgit2-7998ae5ab1d7a37860e10cdb34b3da1532b6efb0.tar.gz | |
Rewrite p_* functions to use Unicode and marshal to UTF8 internally
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; -} |
