Port: normalize windows path on Mingw
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 6 Jun 2017 15:24:21 +0000 (11:24 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 29 Aug 2017 18:31:26 +0000 (14:31 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
common/common.c

index 363ffe2da5725e031954edc75f8c0d3928640ae2..aa67b21f39528436b0d865f37428193ae9777c6e 100644 (file)
@@ -1078,6 +1078,38 @@ void destroy_gstring(void *gstring)
        (void) g_string_free(gstring, TRUE);
 }
 
+#ifdef __MINGW32__
+BT_HIDDEN
+GString *bt_common_normalize_path(const char *path, const char *wd)
+{
+       char *tmp;
+       GString *norm_path = NULL;
+
+       assert(path);
+
+       tmp = _fullpath(NULL, path, PATH_MAX);
+       if (!tmp) {
+               goto error;
+       }
+
+       norm_path = g_string_new(tmp);
+       if (!norm_path) {
+               goto error;
+       }
+
+       goto end;
+error:
+       if (norm_path) {
+               g_string_free(norm_path, TRUE);
+               norm_path = NULL;
+       }
+end:
+       if (tmp) {
+               free(tmp);
+       }
+       return norm_path;
+}
+#else
 BT_HIDDEN
 GString *bt_common_normalize_path(const char *path, const char *wd)
 {
@@ -1161,6 +1193,7 @@ end:
 
        return norm_path;
 }
+#endif
 
 BT_HIDDEN
 size_t bt_common_get_page_size(void)
This page took 0.025131 seconds and 4 git commands to generate.