[geany/geany-plugins] e404f8: geanygendoc: Fix references to installation paths on Windows

Colomban Wendling git-noreply at xxxxx
Sat Mar 12 23:58:11 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 12 Mar 2016 23:58:11 UTC
Commit:      e404f88f699f3dc18610527de471aae9d2a4bfd3
             https://github.com/geany/geany-plugins/commit/e404f88f699f3dc18610527de471aae9d2a4bfd3

Log Message:
-----------
geanygendoc: Fix references to installation paths on Windows


Modified Paths:
--------------
    geanygendoc/src/ggd-plugin.c
    geanygendoc/src/ggd-utils.c

Modified: geanygendoc/src/ggd-plugin.c
13 lines changed, 12 insertions(+), 1 deletions(-)
===================================================================
@@ -366,7 +366,18 @@ static void
 open_manual_handler (GtkWidget  *widget,
                      gpointer    data)
 {
-  utils_open_browser (DOCDIR "/" GGD_PLUGIN_CNAME "/html/manual.html");
+#ifdef G_OS_WIN32
+  gchar *prefix = g_win32_get_package_installation_directory_of_module (NULL);
+#else
+  gchar *prefix = NULL;
+#endif
+  gchar *path = g_build_filename (prefix ? prefix : "", PLUGINDOCDIR,
+                                  "/html/manual.html", NULL);
+  
+  utils_open_browser (path);
+  
+  g_free (path);
+  g_free (prefix);
 }
 
 /* handler that reloads the configuration */


Modified: geanygendoc/src/ggd-utils.c
9 lines changed, 8 insertions(+), 1 deletions(-)
===================================================================
@@ -161,6 +161,7 @@ ggd_get_config_file (const gchar *name,
                      GError     **error)
 {
   gchar  *path = NULL;
+  gchar  *system_prefix = NULL;
   gchar  *user_dir;
   gchar  *user_path;
   gchar  *system_dir;
@@ -169,12 +170,17 @@ ggd_get_config_file (const gchar *name,
   g_return_val_if_fail (name != NULL, NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
   
+#ifdef G_OS_WIN32
+  system_prefix = g_win32_get_package_installation_directory_of_module (NULL);
+#endif
+  
   /* here we guess the locale encoding is ASCII-compatible, anyway it's the case
    * on Windows since we use UTF-8 and on UNIX it would cause too much troubles
    * everywhere if it is not anyway */
   user_dir = g_build_filename (geany->app->configdir, "plugins",
                                GGD_PLUGIN_CNAME, section, NULL);
-  system_dir = g_build_filename (PKGDATADIR, GGD_PLUGIN_CNAME, section, NULL);
+  system_dir = g_build_filename (system_prefix ? system_prefix : "",
+                                 PLUGINDATADIR, section, NULL);
   user_path = g_build_filename (user_dir, name, NULL);
   system_path = g_build_filename (system_dir, name, NULL);
   if (perms_req & GGD_PERM_R) {
@@ -253,6 +259,7 @@ ggd_get_config_file (const gchar *name,
   if (path != system_path) g_free (system_path);
   g_free (user_dir);
   g_free (system_dir);
+  g_free (system_prefix);
   
   return path;
 }



--------------
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