From 4eb1edd5538af23101a0dc765abc394a06fbd3c0 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Sat, 30 Mar 2019 19:05:38 +0100 Subject: 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 --- src/inkscape-main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/inkscape-main.cpp') 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); -- cgit v1.2.3