diff options
| author | Martin Owens <doctormo@gmail.com> | 2017-06-23 15:38:19 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2017-06-23 15:38:19 +0000 |
| commit | 131b4d74439118c7533b0adb7353aa7e29ba93ae (patch) | |
| tree | d502c01751d683ffa73aaec48f6d5e7ea48ca75d /src | |
| parent | Attempt to make paintbucket build option not cause errors for toolbar loading (diff) | |
| parent | Attempt to make paintbucket build option not cause errors for toolbar loading (diff) | |
| download | inkscape-131b4d74439118c7533b0adb7353aa7e29ba93ae.tar.gz inkscape-131b4d74439118c7533b0adb7353aa7e29ba93ae.zip | |
Merge branch 'ui-files-for-ui-xml' of gitlab.com:inkscape/inkscape into ui-files-for-ui-xml
Diffstat (limited to 'src')
| -rw-r--r-- | src/inkgc/gc-core.h | 4 | ||||
| -rw-r--r-- | src/path-prefix.h | 32 | ||||
| -rw-r--r-- | src/prefix.cpp | 75 | ||||
| -rw-r--r-- | src/prefix.h | 12 | ||||
| -rw-r--r-- | src/trace/trace.h | 2 | ||||
| -rw-r--r-- | src/util/ege-tags.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/ege-paint-def.cpp | 2 | ||||
| -rw-r--r-- | src/xml/repr-util.cpp | 4 |
8 files changed, 40 insertions, 93 deletions
diff --git a/src/inkgc/gc-core.h b/src/inkgc/gc-core.h index a27510f50..407c857fb 100644 --- a/src/inkgc/gc-core.h +++ b/src/inkgc/gc-core.h @@ -19,11 +19,7 @@ #include <new> #include <cstdlib> -#ifdef HAVE_GC_GC_H -# include <gc/gc.h> -#else # include <gc.h> -#endif namespace Inkscape { namespace GC { diff --git a/src/path-prefix.h b/src/path-prefix.h index 8a39ede84..e54a80f28 100644 --- a/src/path-prefix.h +++ b/src/path-prefix.h @@ -51,22 +51,22 @@ #else # ifdef WIN32 # define INKSCAPE_APPICONDIR WIN32_DATADIR("pixmaps") -# define INKSCAPE_ATTRRELDIR WIN32_DATADIR("share\\attributes") -# define INKSCAPE_BINDDIR WIN32_DATADIR("share\\bind") -# define INKSCAPE_EXAMPLESDIR WIN32_DATADIR("share\\examples") -# define INKSCAPE_EXTENSIONDIR WIN32_DATADIR("share\\extensions") -# define INKSCAPE_FILTERDIR WIN32_DATADIR("share\\filters") -# define INKSCAPE_GRADIENTSDIR WIN32_DATADIR("share\\gradients") -# define INKSCAPE_KEYSDIR WIN32_DATADIR("share\\keys") -# define INKSCAPE_PIXMAPDIR WIN32_DATADIR("share\\icons") -# define INKSCAPE_MARKERSDIR WIN32_DATADIR("share\\markers") -# define INKSCAPE_PALETTESDIR WIN32_DATADIR("share\\palettes") -# define INKSCAPE_PATTERNSDIR WIN32_DATADIR("share\\patterns") -# define INKSCAPE_SCREENSDIR WIN32_DATADIR("share\\screens") -# define INKSCAPE_SYMBOLSDIR WIN32_DATADIR("share\\symbols") -# define INKSCAPE_TUTORIALSDIR WIN32_DATADIR("share\\tutorials") -# define INKSCAPE_TEMPLATESDIR WIN32_DATADIR("share\\templates") -# define INKSCAPE_UIDIR WIN32_DATADIR("share\\ui") +# define INKSCAPE_ATTRRELDIR WIN32_DATADIR("attributes") +# define INKSCAPE_BINDDIR WIN32_DATADIR("bind") +# define INKSCAPE_EXAMPLESDIR WIN32_DATADIR("examples") +# define INKSCAPE_EXTENSIONDIR WIN32_DATADIR("extensions") +# define INKSCAPE_FILTERDIR WIN32_DATADIR("filters") +# define INKSCAPE_GRADIENTSDIR WIN32_DATADIR("gradients") +# define INKSCAPE_KEYSDIR WIN32_DATADIR("keys") +# define INKSCAPE_PIXMAPDIR WIN32_DATADIR("icons") +# define INKSCAPE_MARKERSDIR WIN32_DATADIR("markers") +# define INKSCAPE_PALETTESDIR WIN32_DATADIR("palettes") +# define INKSCAPE_PATTERNSDIR WIN32_DATADIR("patterns") +# define INKSCAPE_SCREENSDIR WIN32_DATADIR("screens") +# define INKSCAPE_SYMBOLSDIR WIN32_DATADIR("symbols") +# define INKSCAPE_TUTORIALSDIR WIN32_DATADIR("tutorials") +# define INKSCAPE_TEMPLATESDIR WIN32_DATADIR("templates") +# define INKSCAPE_UIDIR WIN32_DATADIR("ui") //CREATE V0.1 WIN32 support # define CREATE_GRADIENTSDIR WIN32_DATADIR("create\\gradients\\gimp") # define CREATE_PALETTESDIR WIN32_DATADIR("create\\swatches") diff --git a/src/prefix.cpp b/src/prefix.cpp index 4e2204cff..c8bf7abec 100644 --- a/src/prefix.cpp +++ b/src/prefix.cpp @@ -419,72 +419,37 @@ br_extract_prefix (const char *path) #ifdef __WIN32__ - /** * Provide a similar mechanism for Win32. Enable a macro, * WIN32_DATADIR, that can look up subpaths for inkscape resources - */ - -#include <windows.h> -#include <glibmm/ustring.h> - -/** - * Return the directory of the .exe that is currently running */ -Glib::ustring win32_getExePath() -{ - gunichar2 path[2048]; - GetModuleFileNameW(0, (WCHAR*) path, 2048); - gchar *exe = g_utf16_to_utf8(path, -1, 0,0,0); - gchar *dir = g_path_get_dirname(exe); - Glib::ustring ret = dir; - g_free(dir); - g_free(exe); - return ret; -} - /** - * Return the relocatable version of the datadir, - * probably c:\inkscape + * Get the Windows-equivalent of INKSCAPE_DATADIR and append a relative path + * + * - by default INKSCAPE_DATADIR will be relative to the called executable + * (typically inkscape/share but also handles the case where the executable is in a /bin subfolder) + * - to override set the INKSCAPE_DATADIR environment variable */ -static Glib::ustring win32_getDataDir() -{ - Glib::ustring dir = win32_getExePath(); - if (INKSCAPE_DATADIR && *INKSCAPE_DATADIR && - strcmp(INKSCAPE_DATADIR, ".") != 0) - { - dir += "\\"; - dir += INKSCAPE_DATADIR; - } - return dir; -} - -static Glib::ustring win32_getResourcePath(const Glib::ustring &childPath) +char *win32_append_datadir(const char *relative_path) { - Glib::ustring dir = win32_getDataDir(); - if (childPath.size() > 0) - { - dir += "\\"; - dir += childPath; + static gchar *datadir; + if (!datadir) { + gchar const *inkscape_datadir = g_getenv("INKSCAPE_DATADIR"); + if (inkscape_datadir) { + datadir = g_strdup(inkscape_datadir); + } else { + gchar *module_path = g_win32_get_package_installation_directory_of_module(NULL); + datadir = g_build_filename(module_path, "share", NULL); + g_free(module_path); } - return dir; -} + } + if (!relative_path) { + relative_path = ""; + } -/** - * This is the visible utility function - */ -char *win32_relative_path(const char *childPath) -{ - static char *returnPath = 0; - if (!childPath) - childPath = ""; - Glib::ustring resourcePath = win32_getResourcePath(childPath); - if (returnPath) - free(returnPath); - returnPath = strdup(resourcePath.c_str()); - return returnPath; + return g_build_filename(datadir, relative_path, NULL); } #endif /* __WIN32__ */ diff --git a/src/prefix.h b/src/prefix.h index 7c5a1fd3c..d28e896d0 100644 --- a/src/prefix.h +++ b/src/prefix.h @@ -119,14 +119,10 @@ char *br_extract_prefix(const char *path); #endif /* __cplusplus */ #ifdef __WIN32__ - -#include <glibmm/ustring.h> - -Glib::ustring win32_getExePath(); -char *win32_relative_path(const char *childPath); - -#define WIN32_DATADIR(suffix) (win32_relative_path(suffix)) - +char *win32_append_datadir(const char *relative_path); +#undef INKSCAPE_DATADIR +#define INKSCAPE_DATADIR win32_append_datadir(NULL) +#define WIN32_DATADIR(suffix) (win32_append_datadir(suffix)) #endif #endif /* _PREFIX_H_ */ diff --git a/src/trace/trace.h b/src/trace/trace.h index f562e89aa..4bf13123b 100644 --- a/src/trace/trace.h +++ b/src/trace/trace.h @@ -13,9 +13,7 @@ # include "config.h" #endif -#ifdef HAVE_STRING_H # include <string.h> -#endif #include <glibmm/refptr.h> #include <gdkmm/pixbuf.h> diff --git a/src/util/ege-tags.cpp b/src/util/ege-tags.cpp index 8a2ce0529..dcc28f370 100644 --- a/src/util/ege-tags.cpp +++ b/src/util/ege-tags.cpp @@ -38,9 +38,7 @@ #include "config.h" #endif // HAVE_CONFIG_H -#if HAVE_LIBINTL_H #include <libintl.h> -#endif // HAVE_LIBINTL_H #if !defined(_) #define _(s) gettext(s) diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index 1a8ad041a..8e0ec9352 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -36,9 +36,7 @@ #include "config.h" -#ifdef HAVE_LIBINTL_H #include <libintl.h> -#endif #include <stdint.h> #include <string> diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 4d093a4ea..6da1233db 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -17,13 +17,9 @@ #include "config.h" -#if HAVE_STRING_H # include <cstring> -#endif -#if HAVE_STDLIB_H # include <cstdlib> -#endif #include <glib.h> |
