[libgxps] parse-utils: avoid mixing files with paths
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] parse-utils: avoid mixing files with paths
- Date: Fri, 13 Jan 2017 20:10:44 +0000 (UTC)
commit 8f04b292c0e551e2ba8dba2c77012699e40685c7
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Mon Jan 9 10:19:31 2017 +0100
parse-utils: avoid mixing files with paths
When getting the relative path we should not try to use GFile
since this will convert internally the paths from / to \ instead
we should deal with paths directly so the paths do not get
mixed up on Windows.
libgxps/gxps-parse-utils.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/libgxps/gxps-parse-utils.c b/libgxps/gxps-parse-utils.c
index cd180e4..ebdf0ff 100644
--- a/libgxps/gxps-parse-utils.c
+++ b/libgxps/gxps-parse-utils.c
@@ -406,8 +406,6 @@ gchar *
gxps_resolve_relative_path (const gchar *source,
const gchar *target)
{
- GFile *source_file;
- GFile *abs_file;
gchar *dirname;
gchar *retval;
@@ -417,13 +415,10 @@ gxps_resolve_relative_path (const gchar *source,
dirname = g_path_get_dirname (source);
if (strlen (dirname) == 1 && dirname[0] == '.')
dirname[0] = '/';
- source_file = g_file_new_for_path (dirname);
- g_free (dirname);
- abs_file = g_file_resolve_relative_path (source_file, target);
- retval = g_file_get_path (abs_file);
- g_object_unref (abs_file);
- g_object_unref (source_file);
+ /* We want / on all platforms */
+ retval = g_build_path ("/", dirname, target, NULL);
+ g_free (dirname);
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]