summaryrefslogtreecommitdiffstats
path: root/src/inkscape-main.cpp
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-03-30 18:05:38 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-03-30 20:30:51 +0000
commit4eb1edd5538af23101a0dc765abc394a06fbd3c0 (patch)
treeaff66da014659ea40851c9f479a30b4dcc93f1c2 /src/inkscape-main.cpp
parentRestore "Add inkscape root directory to DLL search path" (diff)
downloadinkscape-4eb1edd5538af23101a0dc765abc394a06fbd3c0.tar.gz
inkscape-4eb1edd5538af23101a0dc765abc394a06fbd3c0.zip
Add inscape to search path
This primarily allows extensions to simply call "inkscape" without requiring the user to modify environment variables or worrying about different versions of inkscape on the same machine (as we prefix the search path). We did this already for Windows but the code was removed in db05b842cba28f01b431eee890537959aa2d8fe3 Partially fixes https://gitlab.com/inkscape/inkscape/issues/115
Diffstat (limited to 'src/inkscape-main.cpp')
-rw-r--r--src/inkscape-main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/inkscape-main.cpp b/src/inkscape-main.cpp
index a8499412c..e25c6b71c 100644
--- a/src/inkscape-main.cpp
+++ b/src/inkscape-main.cpp
@@ -19,6 +19,16 @@
static void set_extensions_env()
{
+ // add inkscape to PATH, so the correct version is always available to extensions by simply calling "inkscape"
+ gchar *program_dir = get_program_dir();
+ if (program_dir) {
+ gchar const *path = g_getenv("PATH");
+ gchar *new_path = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", program_dir, path);
+ g_setenv("PATH", new_path, true);
+ g_free(new_path);
+ }
+ 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);