From 09b38582c874646b49d10a8f11850c10b9c6ad39 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Sat, 30 Mar 2019 19:57:35 +0100 Subject: Remove "get_extensions_path()" Contrary to what the name and placing suggest it's not a general utility function but a specialized function that constructs the full value to set for PYTHONPATH. Despite the misleading placement most functionality is unneeded: * INKSCAPE_EXTENSIONDIR should always be absolute * g_setenv recommends UTF-8 on Windows --- src/path-prefix.cpp | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'src/path-prefix.cpp') diff --git a/src/path-prefix.cpp b/src/path-prefix.cpp index 92efcb895..b44bc42f8 100644 --- a/src/path-prefix.cpp +++ b/src/path-prefix.cpp @@ -20,10 +20,10 @@ #include // for _NSGetExecutablePath #endif -#include "io/resource.h" -#include "path-prefix.h" #include +#include "path-prefix.h" + /** * Determine the location of the Inkscape data directory (typically the share/ folder * from where Inkscape should be loading resources) and append a relative path @@ -62,42 +62,6 @@ char *append_inkscape_datadir(const char *relative_path) return g_build_filename(inkscape_datadir, relative_path, NULL); } -gchar *get_extensions_path() -{ - using namespace Inkscape::IO::Resource; - gchar const *pythonpath = g_getenv("PYTHONPATH"); - gchar *extdir; - gchar *new_pythonpath; - -#ifdef _WIN32 - extdir = g_win32_locale_filename_from_utf8(INKSCAPE_EXTENSIONDIR); -#else - extdir = g_strdup(INKSCAPE_EXTENSIONDIR); -#endif - - // On some platforms, INKSCAPE_EXTENSIONDIR is not absolute, - // but relative to the directory that contains the Inkscape executable. - // Since we spawn Python chdir'ed into the script's directory, - // we need to obtain the absolute path here. - if (!g_path_is_absolute(extdir)) { - gchar *curdir = g_get_current_dir(); - gchar *extdir_new = g_build_filename(curdir, extdir, NULL); - g_free(extdir); - g_free(curdir); - extdir = extdir_new; - } - - if (pythonpath) { - new_pythonpath = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", extdir, pythonpath); - g_free(extdir); - } - else { - new_pythonpath = extdir; - } - - return new_pythonpath; -} - /** * Gets the the currently running program's executable name (including full path) * -- cgit v1.2.3