[glib] glocalfile: fix g_file_get_parse_name() on win32
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] glocalfile: fix g_file_get_parse_name() on win32
- Date: Mon, 6 Aug 2012 15:34:03 +0000 (UTC)
commit 5c91af7e41443252857cdcf6fe0f0dabdc0b5250
Author: Dan Winship <danw gnome org>
Date: Fri Feb 3 11:10:50 2012 -0500
glocalfile: fix g_file_get_parse_name() on win32
When getting the parse name for a file: URI on win32, we were not
translating "\" to "/", resulting in incorrect output.
https://bugzilla.gnome.org/show_bug.cgi?id=669331
gio/glocalfile.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 176817d..0c54727 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -414,6 +414,23 @@ g_local_file_get_parse_name (GFile *file)
}
else
{
+#ifdef G_OS_WIN32
+ char *dup_filename, *p, *backslash;
+
+ /* Turn backslashes into forward slashes like
+ * g_filename_to_uri() would do (but we can't use that because
+ * it doesn't output IRIs).
+ */
+ dup_filename = g_strdup (filename);
+ filename = p = dup_filename;
+
+ while ((backslash = strchr (p, '\\')) != NULL)
+ {
+ *backslash = '/';
+ p = backslash + 1;
+ }
+#endif
+
escaped_path = g_uri_escape_string (filename,
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/",
TRUE);
@@ -423,7 +440,9 @@ g_local_file_get_parse_name (GFile *file)
NULL);
g_free (escaped_path);
-
+#ifdef G_OS_WIN32
+ g_free (dup_filename);
+#endif
if (free_utf8_filename)
g_free (utf8_filename);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]