diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es> | 2018-07-24 17:28:19 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es> | 2018-07-24 17:28:19 +0000 |
| commit | 2984959869ff341299e12f6b2ada2aba49fef2e4 (patch) | |
| tree | 1a0af64b915b7952f270c4e1f464913722c90085 /src/main.cpp | |
| parent | Toggle symbolic icons staff depending the theme has it or not (diff) | |
| download | inkscape-2984959869ff341299e12f6b2ada2aba49fef2e4.tar.gz inkscape-2984959869ff341299e12f6b2ada2aba49fef2e4.zip | |
Add themes inkscape folder abailable by the app
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index fb73eb810..108e5b0b2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,6 +80,7 @@ #include "xml/repr.h" +#include "io/resource.h" #include "io/sys.h" #include "debug/logger.h" @@ -646,6 +647,34 @@ static void set_extensions_env() //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; + } + + g_setenv("XDG_DATA_HOME", datadir, TRUE); + g_free(datadir); + //printf("XDG_DATA_HOME = %s\n", g_getenv("XDG_DATA_HOME")); +} + /** * This is the classic main() entry point of the program, though on some * architectures it might be called by something else. @@ -676,6 +705,7 @@ main(int argc, char **argv) rt.setPathInfo(); } #endif + set_datadir_env(); set_extensions_env(); // Prevents errors like "Unable to wrap GdkPixbuf..." (in nr-filter-image.cpp for example) |
