[gegl] Bug 588172 - libgegl uses deprecated g_win32_get_package_installation_subdirectory ()



commit f0301668fd6ad71a66c7fd02224e54e72bfbd3b7
Author: Michael Schumacher <schumaml gmx de>
Date:   Sun Aug 9 23:53:57 2009 +0200

    Bug 588172 - libgegl uses deprecated g_win32_get_package_installation_subdirectory ()
    
    Added a DllMain function to get the module handle that has to be passed to
    g_win32_get_package_installation_directory_of_module.

 gegl/gegl-init.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 89542bf..81e0fba 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -39,6 +39,22 @@
 
 #include <windows.h>
 
+static HMODULE hLibGeglModule = NULL;
+
+/* DllMain prototype */
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, 
+                     DWORD     fdwReason, 
+                     LPVOID    lpvReserved);
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL, 
+         DWORD     fdwReason, 
+         LPVOID    lpvReserved)
+{
+  hLibGeglModule = hinstDLL;
+  return TRUE;
+}
+
 static inline gboolean
 pid_is_running (gint pid)
 {
@@ -502,10 +518,12 @@ gegl_post_parse_hook (GOptionContext *context,
           gchar *module_path;
 
 #ifdef G_OS_WIN32
-          module_path =
-            g_win32_get_package_installation_subdirectory (NULL,
-                                                           "lib" GEGL_LIBRARY "-0.dll",
-                                                           "lib/" GEGL_LIBRARY);
+          {
+            gchar *prefix;
+            prefix = g_win32_get_package_installation_directory_of_module ( hLibGeglModule );
+            module_path = g_build_filename (prefix, "lib", GEGL_LIBRARY, NULL);
+            g_free(prefix);
+          }
 #else
           module_path = g_build_filename (LIBDIR, GEGL_LIBRARY, NULL);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]