+ gchar tmp[PATH_MAX];
+ gchar *app_dir;
+ gchar res_dir[PATH_MAX];
+ struct stat sb;
+
+ app_dir = g_path_get_dirname (resolved_path);
+ g_snprintf (tmp, sizeof(tmp), "%s/../../Resources", app_dir);
+ if (realpath (tmp, res_dir) && !stat (res_dir,&sb) && S_ISDIR (sb.st_mode))
+ g_print ("pspp is started as MacOS application\n");
+ else
+ return;
+ g_free (app_dir);
+
+ g_snprintf (tmp, sizeof(tmp), "%s/lib/gtk-3.0/3.0.0", res_dir);
+ g_setenv ("GTK_PATH", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/etc/gtk-3.0/gtk.immodules", res_dir);
+ g_setenv ("GTK_IM_MODULE_FILE", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/lib/gegl-0.4", res_dir);
+ g_setenv ("GEGL_PATH", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/lib/babl-0.1", res_dir);
+ g_setenv ("BABL_PATH", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache", res_dir);
+ g_setenv ("GDK_PIXBUF_MODULE_FILE", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/etc/fonts", res_dir);
+ g_setenv ("FONTCONFIG_PATH", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/lib/gio/modules", res_dir);
+ g_setenv ("GIO_MODULE_DIR", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/etc/xdg", res_dir);
+ g_setenv ("XDG_CONFIG_DIRS", tmp, TRUE);
+ g_snprintf (tmp, sizeof(tmp), "%s/share", res_dir);
+ g_setenv ("XDG_DATA_DIRS", tmp, TRUE);
+
+ if (g_getenv ("HOME")!=NULL)
+ {
+ g_snprintf (tmp, sizeof(tmp),
+ "%s/Library/Application Support/pspp/1.3/cache",
+ g_getenv("HOME"));
+ g_setenv ("XDG_CACHE_HOME", tmp, TRUE);
+ }