diff options
| author | nulltoken <emeric.fermas@gmail.com> | 2011-03-15 22:07:01 +0100 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-03-23 00:17:24 +0200 |
| commit | 677a3c07f47f46dcbab4a3ee8a1e2aace6f999b0 (patch) | |
| tree | 9e638926a6d72f963d5102b676d574702b8d36c3 /src/fileops.c | |
| parent | ae6ba7f713804e1c04febee81a8f52ea0abf443b (diff) | |
| download | libgit2-677a3c07f47f46dcbab4a3ee8a1e2aace6f999b0.tar.gz | |
Add failing test for issue 84
see https://github.com/libgit2/libgit2/issues#issue/84
Diffstat (limited to 'src/fileops.c')
| -rw-r--r-- | src/fileops.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/fileops.c b/src/fileops.c index a884b4002..4ed53bc97 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -633,3 +633,34 @@ int gitfo_cmp_path(const char *name1, int len1, int isdir1, return 0; } +static void posixify_path(char *path) +{ + while (*path) { + if (*path == '\\') + *path = '/'; + + path++; + } +} + +int gitfo_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); //TODO: Fixme. Ensure the required headers are correctly included +#endif + + if (cwd_buffer == NULL) + return GIT_EOSERR; + + posixify_path(buffer_out); + + git__joinpath(buffer_out, buffer_out, ""); //Ensure the path ends with a trailing slash + + return GIT_SUCCESS; +} |
