diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-06-13 20:09:30 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-06-14 19:17:16 +0000 |
| commit | 812f50f709384d6c59587c9f1706e401600291a6 (patch) | |
| tree | ca79e5ecb56b4c2197d0620913282f071b219d81 /src/path-prefix.cpp | |
| parent | Update it.po (diff) | |
| download | inkscape-812f50f709384d6c59587c9f1706e401600291a6.tar.gz inkscape-812f50f709384d6c59587c9f1706e401600291a6.zip | |
append_inkscape_datadir: Always canonicalize full filename
Avoids potentially dangerous mix of different path separators.
Diffstat (limited to 'src/path-prefix.cpp')
| -rw-r--r-- | src/path-prefix.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/path-prefix.cpp b/src/path-prefix.cpp index e8b4b0205..c447bb562 100644 --- a/src/path-prefix.cpp +++ b/src/path-prefix.cpp @@ -3,7 +3,7 @@ * path-prefix.cpp - Inkscape specific prefix handling *//* * Authors: * Patrick Storz <eduard.braun2@gmx.de> - * + * * Copyright (C) 2018 Authors * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ @@ -39,11 +39,7 @@ char *append_inkscape_datadir(const char *relative_path) if (!inkscape_datadir) { gchar const *datadir_env = g_getenv("INKSCAPE_DATADIR"); if (datadir_env) { -#if GLIB_CHECK_VERSION(2,58,0) - inkscape_datadir = g_canonicalize_filename(datadir_env, NULL); -#else inkscape_datadir = g_strdup(datadir_env); -#endif } else { #ifdef _WIN32 gchar *module_path = g_win32_get_package_installation_directory_of_module(NULL); @@ -55,11 +51,11 @@ char *append_inkscape_datadir(const char *relative_path) } } - if (!relative_path) { - relative_path = ""; - } - +#if GLIB_CHECK_VERSION(2,58,0) + return g_canonicalize_filename(relative_path, inkscape_datadir); +#else return g_build_filename(inkscape_datadir, relative_path, NULL); +#endif } /** |
