SF.net SVN: geany-plugins:[780] trunk/geany-plugins/geanylua

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Jun 24 18:27:05 UTC 2009


Revision: 780
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=780&view=rev
Author:   eht16
Date:     2009-06-24 18:27:05 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
Build libdir and datadir paths on Windows using the installation directory as prefix. This still can be improved.

Modified Paths:
--------------
    trunk/geany-plugins/geanylua/ChangeLog
    trunk/geany-plugins/geanylua/geanylua.c
    trunk/geany-plugins/geanylua/glspi_init.c

Modified: trunk/geany-plugins/geanylua/ChangeLog
===================================================================
--- trunk/geany-plugins/geanylua/ChangeLog	2009-06-24 18:23:17 UTC (rev 779)
+++ trunk/geany-plugins/geanylua/ChangeLog	2009-06-24 18:27:05 UTC (rev 780)
@@ -1,3 +1,6 @@
+June 24, 2009 (eht16)
+  Build libdir and datadir paths on Windows using the installation
+  directory as prefix. This still can be improved.
 June 23, 2009 (ntrel)
   Look for support library in LIBDIR/geany-plugins/geanylua.
   Read scripts from DATADIR/geany-plugins/geanylua.

Modified: trunk/geany-plugins/geanylua/geanylua.c
===================================================================
--- trunk/geany-plugins/geanylua/geanylua.c	2009-06-24 18:23:17 UTC (rev 779)
+++ trunk/geany-plugins/geanylua/geanylua.c	2009-06-24 18:27:05 UTC (rev 780)
@@ -128,7 +128,25 @@
 static GeanyData *geany_data=NULL;
 
 
+static gchar *get_lib_dir(void)
+{
+#ifdef G_OS_WIN32
+	gchar *install_dir, *result;
+# if GLIB_CHECK_VERSION(2, 16, 0)
+	install_dir = g_win32_get_package_installation_directory_of_module(NULL);
+# else
+	install_dir = g_win32_get_package_installation_directory(NULL, NULL);
+# endif
+	result = g_strconcat(install_dir, "\\lib", NULL);
+	g_free(install_dir);
+	return result;
+#else
+	return g_strdup(LIBDIR);
+#endif
+}
 
+
+
 PLUGIN_EXPORT
 void plugin_init(GeanyData *data)
 {
@@ -139,8 +157,10 @@
 	geany_data=data;
 	libname=g_build_path(G_DIR_SEPARATOR_S, data->app->configdir, "plugins", "geanylua", SUPPORT_LIB, NULL);
 	if ( !g_file_test(libname,G_FILE_TEST_IS_REGULAR) ) {
+		gchar *libdir=get_lib_dir();
 		g_free(libname);
-		libname=g_build_path(G_DIR_SEPARATOR_S, LIBDIR, "geany-plugins", "geanylua", SUPPORT_LIB, NULL);
+		libname=g_build_path(G_DIR_SEPARATOR_S, libdir, "geany-plugins", "geanylua", SUPPORT_LIB, NULL);
+		g_free(libdir);
 	}
 	if ( !g_file_test(libname,G_FILE_TEST_IS_REGULAR) ) {
 		g_printerr(_("%s: Can't find support library %s!\n"), PLUGIN_NAME, libname);

Modified: trunk/geany-plugins/geanylua/glspi_init.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_init.c	2009-06-24 18:23:17 UTC (rev 779)
+++ trunk/geany-plugins/geanylua/glspi_init.c	2009-06-24 18:27:05 UTC (rev 780)
@@ -434,7 +434,25 @@
 }
 
 
+static gchar *get_data_dir(void)
+{
+#ifdef G_OS_WIN32
+	gchar *install_dir, *result;
+# if GLIB_CHECK_VERSION(2, 16, 0)
+	install_dir = g_win32_get_package_installation_directory_of_module(NULL);
+# else
+	install_dir = g_win32_get_package_installation_directory(NULL, NULL);
+# endif
+	result = g_strconcat(install_dir, "\\share", NULL);
+	g_free(install_dir);
+	return result;
+#else
+	return g_strdup(LIBDIR);
+#endif
+}
 
+
+
 /* Called by Geany to initialize the plugin */
 PLUGIN_EXPORT
 void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyKeyGroup *kg)
@@ -448,9 +466,11 @@
 		g_strconcat(app->configdir, USER_SCRIPT_FOLDER, NULL);
 
 	if (!g_file_test(local_data.script_dir, G_FILE_TEST_IS_DIR)) {
+		gchar *datadir = get_data_dir();
 		g_free(local_data.script_dir);
 		local_data.script_dir =
-			g_build_path(G_DIR_SEPARATOR_S, DATADIR, "geany-plugins", "geanylua", NULL);
+			g_build_path(G_DIR_SEPARATOR_S, datadir, "geany-plugins", "geanylua", NULL);
+		g_free(datadir);
   }
 	if (app->debug_mode) {
 		g_printerr(_("     ==>> %s: Building menu from '%s'\n"),


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list