summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-03-30 16:05:21 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-03-30 16:05:21 +0000
commit7dd671c8bf7f9aa02afb4128f75fcd3684e9641d (patch)
tree53ddf74e5a8bf9b753f0e657e7e6fffddba6703f /src/main.cpp
parentTranslations. PO files mega update. (diff)
downloadinkscape-7dd671c8bf7f9aa02afb4128f75fcd3684e9641d.tar.gz
inkscape-7dd671c8bf7f9aa02afb4128f75fcd3684e9641d.zip
Make all paths in PYTHONPATH absolute.
Fixed bugs: - https://launchpad.net/bugs/551433 (bzr r9261)
Diffstat (limited to '')
-rw-r--r--src/main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cd60d9fa1..32102f3b3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -552,6 +552,19 @@ static void set_extensions_env()
#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);
@@ -562,7 +575,7 @@ static void set_extensions_env()
g_setenv("PYTHONPATH", new_pythonpath, TRUE);
g_free(new_pythonpath);
- printf("PYTHONPATH = %s", g_getenv("PYTHONPATH"));
+ printf("PYTHONPATH = %s\n", g_getenv("PYTHONPATH"));
}
/**
@@ -588,7 +601,6 @@ main(int argc, char **argv)
HKCR\svgfile\shell\open\command is a good example
TODO: this breaks the CLI on Windows, see LP #167455
- However, the CLI is broken anyway, because we are a GUI app
*/
const int pathbuf = 2048;
gunichar2 *path = g_new(gunichar2, pathbuf);