summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-03-30 18:57:35 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-03-30 20:30:51 +0000
commit09b38582c874646b49d10a8f11850c10b9c6ad39 (patch)
tree6d79e6334315cbf1b5453bef2b111c3587e86647 /src
parentRemove unused "get_datadir_path()" (diff)
downloadinkscape-09b38582c874646b49d10a8f11850c10b9c6ad39.tar.gz
inkscape-09b38582c874646b49d10a8f11850c10b9c6ad39.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/inkscape-main.cpp12
-rw-r--r--src/path-prefix.cpp40
-rw-r--r--src/path-prefix.h1
3 files changed, 11 insertions, 42 deletions
diff --git a/src/inkscape-main.cpp b/src/inkscape-main.cpp
index e25c6b71c..aab94542e 100644
--- a/src/inkscape-main.cpp
+++ b/src/inkscape-main.cpp
@@ -30,9 +30,15 @@ static void set_extensions_env()
g_free(program_dir);
// add share/inkscape/extensions to PYTHONPATH so the inkex module is found by extensions in user folder
- gchar *pythonpath = get_extensions_path();
- g_setenv("PYTHONPATH", pythonpath, true);
- g_free(pythonpath);
+ gchar const *pythonpath = g_getenv("PYTHONPATH");
+ gchar *new_pythonpath;
+ if (pythonpath) {
+ new_pythonpath = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", INKSCAPE_EXTENSIONDIR, pythonpath);
+ } else {
+ new_pythonpath = g_strdup(INKSCAPE_EXTENSIONDIR);
+ }
+ g_setenv("PYTHONPATH", new_pythonpath, true);
+ g_free(new_pythonpath);
#ifdef _WIN32
// add inkscape directory to DLL search path so dynamically linked extension modules find their libraries
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 <mach-o/dyld.h> // for _NSGetExecutablePath
#endif
-#include "io/resource.h"
-#include "path-prefix.h"
#include <glib.h>
+#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)
*
diff --git a/src/path-prefix.h b/src/path-prefix.h
index c7d78d926..dd46d2cc4 100644
--- a/src/path-prefix.h
+++ b/src/path-prefix.h
@@ -30,7 +30,6 @@
char *append_inkscape_datadir(const char *relative_path);
-char *get_extensions_path();
char *get_program_name();
char *get_program_dir();