[geany/geany-plugins] 4fd4ac: geniuspaste: Fix locating config files on OS X when using bundle
Jiří Techet
git-noreply at xxxxx
Wed Apr 26 20:46:20 UTC 2017
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Wed, 26 Apr 2017 20:46:20 UTC
Commit: 4fd4ac74292cc5cbe38fa1d12749b6166d5dbe69
https://github.com/geany/geany-plugins/commit/4fd4ac74292cc5cbe38fa1d12749b6166d5dbe69
Log Message:
-----------
geniuspaste: Fix locating config files on OS X when using bundle
Modified Paths:
--------------
geniuspaste/src/geniuspaste.c
Modified: geniuspaste/src/geniuspaste.c
24 lines changed, 17 insertions(+), 7 deletions(-)
===================================================================
@@ -244,17 +244,29 @@ static void load_pastebins_in_dir(const gchar *path)
}
}
-static void load_all_pastebins(void)
+static gchar *get_data_dir_path(const gchar *filename)
{
-#ifdef G_OS_WIN32
- gchar *prefix = g_win32_get_package_installation_directory_of_module(NULL);
-#else
gchar *prefix = NULL;
+ gchar *path;
+
+#ifdef G_OS_WIN32
+ prefix = g_win32_get_package_installation_directory_of_module(NULL);
+#elif defined(__APPLE__)
+ if (g_getenv("GEANY_PLUGINS_SHARE_PATH"))
+ return g_build_filename(g_getenv("GEANY_PLUGINS_SHARE_PATH"),
+ PLUGIN, filename, NULL);
#endif
+ path = g_build_filename(prefix ? prefix : "", PLUGINDATADIR, filename, NULL);
+ g_free(prefix);
+ return path;
+}
+
+static void load_all_pastebins(void)
+{
gchar *paths[] = {
g_build_filename(geany->app->configdir, "plugins", "geniuspaste",
"pastebins", NULL),
- g_build_filename(prefix ? prefix : "", PLUGINDATADIR, "pastebins", NULL)
+ get_data_dir_path("pastebins")
};
guint i;
@@ -264,8 +276,6 @@ static void load_all_pastebins(void)
g_free(paths[i]);
}
pastebins = g_slist_sort(pastebins, sort_pastebins);
-
- g_free(prefix);
}
static void free_all_pastebins(void)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list