summaryrefslogtreecommitdiff
path: root/src/win32/posix.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-07-04 20:05:11 +0200
committerVicent Marti <tanoku@gmail.com>2011-07-05 02:06:26 +0200
commit5ad739e8328c665b629e2285abaec7e12ea8397c (patch)
treebe0677bcaeaa318bf20b8fa765e3bf478fb5bc55 /src/win32/posix.c
parentf79026b4912bcd2336667f4c1663c06e233f0b32 (diff)
downloadlibgit2-5ad739e8328c665b629e2285abaec7e12ea8397c.tar.gz
fileops: Drop `git_fileops_prettify_path`
The old `git_fileops_prettify_path` has been replaced with `git_path_prettify`. This is a much simpler method that uses the OS's `realpath` call to obtain the full path for directories and resolve symlinks. The `realpath` syscall is the original POSIX call in Unix system and an emulated version under Windows using the Windows API.
Diffstat (limited to 'src/win32/posix.c')
-rw-r--r--src/win32/posix.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/win32/posix.c b/src/win32/posix.c
index 003ce1fd6..610a4166c 100644
--- a/src/win32/posix.c
+++ b/src/win32/posix.c
@@ -1,4 +1,5 @@
#include "posix.h"
+#include "path.h"
#include <errno.h>
int p_unlink(const char *path)
@@ -189,3 +190,13 @@ int p_hide_directory__w32(const char *path)
return error;
}
+int p_realpath(const char *orig_path, char *buffer)
+{
+ int ret = GetFullPathName(orig_path, GIT_PATH_MAX, buffer, NULL);
+ if (!ret || ret > GIT_PATH_MAX)
+ return GIT_EOSERR;
+
+ git_path_mkposix(buffer);
+ return GIT_SUCCESS;
+}
+