summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp57
1 files changed, 4 insertions, 53 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 108e5b0b2..14dcb0fe8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -612,64 +612,15 @@ static void _win32_set_inkscape_env(gchar const *exe)
static void set_extensions_env()
{
- 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;
- }
-
- g_setenv("PYTHONPATH", new_pythonpath, TRUE);
- g_free(new_pythonpath);
+ gchar *pythonpath = get_extensions_path();
+ g_setenv("PYTHONPATH", pythonpath, TRUE);
+ g_free(pythonpath);
//printf("PYTHONPATH = %s\n", g_getenv("PYTHONPATH"));
}
static void set_datadir_env()
{
- using namespace Inkscape::IO::Resource;
- gchar *datadir;
-
-#ifdef WIN32
- datadir = g_win32_locale_filename_from_utf8(profile_path(""));
-#else
- datadir = profile_path("");
-#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(datadir)) {
- gchar *curdir = g_get_current_dir();
- gchar *datadir_new = g_build_filename(curdir, datadir, NULL);
- g_free(datadir);
- g_free(curdir);
- datadir = datadir_new;
- }
-
+ gchar *datadir = get_datadir_path();
g_setenv("XDG_DATA_HOME", datadir, TRUE);
g_free(datadir);
//printf("XDG_DATA_HOME = %s\n", g_getenv("XDG_DATA_HOME"));