summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRomain Geissler <romain.geissler@gmail.com>2011-06-03 19:26:45 +0200
committerRomain Geissler <romain.geissler@gmail.com>2011-06-03 19:26:45 +0200
commit04fdc10d3581fb58adc2a3a375fdbb5d57774027 (patch)
tree8b2541ae9f1edd1e2e7b89c09fb1c3d2238ae6a5 /src/fileops.c
parent1e9b7a09ff3d16c3d7a132cfaacb9d68b253e924 (diff)
downloadlibgit2-04fdc10d3581fb58adc2a3a375fdbb5d57774027.tar.gz
Fileops:retrieve_path_root_offset is now named gitfo_retrieve_path_root_offset (like other public functions). Added platform specific directory separator definition.
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/fileops.c b/src/fileops.c
index 73939349d..da4e97efb 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -301,8 +301,19 @@ int gitfo_dirent(
return GIT_SUCCESS;
}
+static void posixify_path(char *path)
+{
+ #if GIT_PLATFORM_PATH_SEP != '/'
+ while (*path) {
+ if (*path == GIT_PLATFORM_PATH_SEP)
+ *path = '/';
+
+ path++;
+ }
+ #endif
+}
-int retrieve_path_root_offset(const char *path)
+int gitfo_retrieve_path_root_offset(const char *path)
{
int offset = 0;
@@ -320,7 +331,6 @@ int retrieve_path_root_offset(const char *path)
return -1; /* Not a real error. Rather a signal than the path is not rooted */
}
-
int gitfo_mkdir_recurs(const char *path, int mode)
{
int error, root_path_offset;
@@ -333,7 +343,7 @@ int gitfo_mkdir_recurs(const char *path, int mode)
error = GIT_SUCCESS;
pp = path_copy;
- root_path_offset = retrieve_path_root_offset(pp);
+ root_path_offset = gitfo_retrieve_path_root_offset(pp);
if (root_path_offset > 0)
pp += root_path_offset; /* On Windows, will skip the drive name (eg. C: or D:) */
@@ -367,7 +377,7 @@ static int retrieve_previous_path_component_start(const char *path)
{
int offset, len, root_offset, start = 0;
- root_offset = retrieve_path_root_offset(path);
+ root_offset = gitfo_retrieve_path_root_offset(path);
if (root_offset > -1)
start += root_offset;
@@ -402,7 +412,7 @@ int gitfo_prettify_dir_path(char *buffer_out, size_t size, const char *path)
buffer_end = path + strlen(path);
buffer_out_start = buffer_out;
- root_path_offset = retrieve_path_root_offset(path);
+ root_path_offset = gitfo_retrieve_path_root_offset(path);
if (root_path_offset < 0) {
error = gitfo_getcwd(buffer_out, size);
if (error < GIT_SUCCESS)
@@ -519,16 +529,6 @@ 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;