summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2015-03-24 18:14:23 -0600
committerFederico Mena Quintero <federico@gnome.org>2015-03-24 18:14:23 -0600
commit28694c791067f0321ae21d44734b1ef88b45d742 (patch)
tree967638c2a9a525654a88aefb15046058ef56fd04
parent7fc95d9571c7d25e548a590aae482f9707f290d2 (diff)
downloadlibrsvg-28694c791067f0321ae21d44734b1ef88b45d742.tar.gz
bgo#710163 - Use _wfullpath() on Windows instead of _fullpath()
-rw-r--r--rsvg-base.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/rsvg-base.c b/rsvg-base.c
index 4ef8a7a6..62340cfa 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -57,13 +57,33 @@
#include "rsvg-paint-server.h"
#include "rsvg-xml.h"
-/*
- * XXX: Perhaps do a GIO-based implementation for
- * realpath() or use gnulib implementation for this
- * https://bugzilla.gnome.org/show_bug.cgi?id=710163
- */
#ifdef G_OS_WIN32
-#define realpath(a,b) _fullpath(b,a,_MAX_PATH)
+static char *
+rsvg_realpath_utf8 (const char *filename, const char *unused)
+{
+ wchar_t *wfilename;
+ wchar_t *wfull;
+ char *full;
+
+ wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
+ if (!wfilename)
+ return NULL;
+
+ wfull = _wfullpath (NULL, wfilename, 0);
+ g_free (wfilename);
+ if (!wfull)
+ return NULL;
+
+ full = g_utf16_to_utf8 (wfull, -1, NULL, NULL, NULL);
+ free (wfull);
+
+ if (!full)
+ return NULL;
+
+ return full;
+}
+
+#define realpath(a,b) rsvg_realpath_utf8 (a, b)
#endif
/*