summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2019-11-05 07:09:07 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-11-05 07:09:07 +0000
commit3d0d003f48467df90d2439232299f881e0e38730 (patch)
tree6e47d8322509cdcce8225bd14550b52018a7c1b3
parentFix https://gitlab.com/inkscape/inbox/issues/871 Measure Segments LPE: Labels... (diff)
downloadinkscape-3d0d003f48467df90d2439232299f881e0e38730.tar.gz
inkscape-3d0d003f48467df90d2439232299f881e0e38730.zip
macOS bundle support for append_inkscape_datadir
-rw-r--r--src/path-prefix.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/path-prefix.cpp b/src/path-prefix.cpp
index f03c5cb8e..29bffbd4f 100644
--- a/src/path-prefix.cpp
+++ b/src/path-prefix.cpp
@@ -46,6 +46,14 @@ char *append_inkscape_datadir(const char *relative_path)
gchar *module_path = g_win32_get_package_installation_directory_of_module(NULL);
datadir = g_build_filename(module_path, "share", NULL);
g_free(module_path);
+#elif defined(__APPLE__)
+ gchar *program_dir = get_program_dir();
+ if (g_str_has_suffix(program_dir, "Contents/MacOS")) {
+ datadir = g_build_filename(program_dir, "../Resources/share", nullptr);
+ } else {
+ datadir = g_strdup(INKSCAPE_DATADIR);
+ }
+ g_free(program_dir);
#else
datadir = g_strdup(INKSCAPE_DATADIR);
#endif
@@ -97,7 +105,7 @@ gchar *get_program_name()
char pathbuf[PATH_MAX + 1];
uint32_t bufsize = sizeof(pathbuf);
if (_NSGetExecutablePath(pathbuf, &bufsize) == 0) {
- program_name = g_strdup(pathbuf);
+ program_name = realpath(pathbuf, nullptr);
} else {
g_warning("get_program_name() - _NSGetExecutablePath failed");
}