Created
March 12, 2016 13:41
-
-
Save eht16/73269ce695445f7494d9 to your computer and use it in GitHub Desktop.
Alternative fix for https://github.com/geany/geany-plugins/pull/402
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/geniuspaste/src/geniuspaste.c b/geniuspaste/src/geniuspaste.c | |
index 2988502..0990f80 100644 | |
--- a/geniuspaste/src/geniuspaste.c | |
+++ b/geniuspaste/src/geniuspaste.c | |
@@ -236,21 +236,40 @@ static void load_pastebins_in_dir(const gchar *path) | |
} | |
} | |
+static gchar *get_plugin_data_directory(void) | |
+{ | |
+ gchar *base = g_win32_get_package_installation_directory_of_module(NULL); | |
+ gchar *geniuspaste_datadir; | |
+ | |
+ geniuspaste_datadir = g_build_filename(base, PKGDATADIR, "geniuspaste", NULL); | |
+ g_free(base); | |
+ | |
+ g_message("%s", geniuspaste_datadir); | |
+ return geniuspaste_datadir; | |
+} | |
+ | |
static void load_all_pastebins(void) | |
{ | |
- gchar *paths[] = { | |
- g_build_filename(geany->app->configdir, "plugins", "geniuspaste", | |
- "pastebins", NULL), | |
- g_build_filename(PLUGINDATADIR, "pastebins", NULL) | |
- }; | |
+ gchar *plugin_data_dir = NULL; | |
+ gchar *paths[2]; | |
guint i; | |
+ paths[0] = g_build_filename(geany->app->configdir, "plugins", "geniuspaste", | |
+ "pastebins", NULL); | |
+#ifdef G_OS_WIN32 | |
+ plugin_data_dir = get_plugin_data_directory(); | |
+ paths[1] = g_build_filename(plugin_data_dir, "pastebins", NULL); | |
+#else | |
+ paths[1] = g_build_filename(PLUGINDATADIR, "pastebins", NULL); | |
+#endif | |
+ | |
for (i = 0; i < G_N_ELEMENTS(paths); i++) | |
{ | |
load_pastebins_in_dir(paths[i]); | |
g_free(paths[i]); | |
} | |
pastebins = g_slist_sort(pastebins, sort_pastebins); | |
+ g_free(plugin_data_dir); | |
} | |
static void free_all_pastebins(void) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment