[libgxps/wip/nacho/separator] parse-utils: convert back \ separators to / on Windows



commit 59d428ceb905555767eec7ce091db4066f460a43
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Sun Jan 29 13:19:13 2017 +0100

    parse-utils: convert back \ separators to / on Windows
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777894

 libgxps/gxps-parse-utils.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libgxps/gxps-parse-utils.c b/libgxps/gxps-parse-utils.c
index 18dff53..95e1ebd 100644
--- a/libgxps/gxps-parse-utils.c
+++ b/libgxps/gxps-parse-utils.c
@@ -418,5 +418,20 @@ gxps_resolve_relative_path (const gchar *source,
        g_object_unref (abs_file);
        g_object_unref (source_file);
 
+       /* NOTE: this is a bit of a hack but GFile converts the path separator /
+        * internally to the one used by the platform which on Windows is \\
+        * so we need to convert it back to /
+        */
+#ifdef G_OS_WIN32
+       {
+               gchar *p;
+
+               for (p = target; p != '\0'; p++) {
+                       if (*p == '\\')
+                               *p = '/';
+               }
+       }
+#endif
+
        return retval;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]