[gtranslator] Workaround to resolve path of plugins folder on windows
- From: Pablo Sanxiao Roca <psanxiao src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtranslator] Workaround to resolve path of plugins folder on windows
- Date: Thu, 30 Jul 2009 21:18:56 +0000 (UTC)
commit f3141a7e3e9cbf6657b1333703ea6f1df940c4eb
Author: Francisco Puga <francisco puga ghandalf org>
Date: Fri Jul 17 19:57:53 2009 +0200
Workaround to resolve path of plugins folder on windows
src/plugin-system/plugins-engine.c | 8 +++++++-
src/utils.c | 30 ++++++++++++++++++++++++++++++
src/utils.h | 1 +
3 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/src/plugin-system/plugins-engine.c b/src/plugin-system/plugins-engine.c
index b8dd922..394edb4 100644
--- a/src/plugin-system/plugins-engine.c
+++ b/src/plugin-system/plugins-engine.c
@@ -42,6 +42,7 @@
#include "plugin.h"
#include "debug.h"
#include "application.h"
+#include "utils.h"
#include "module.h"
#ifdef ENABLE_PYTHON
@@ -185,7 +186,12 @@ gtranslator_plugins_engine_load_all (GtranslatorPluginsEngine *engine)
pdirs_env = g_getenv ("GTR_PLUGINS_PATH");
/* What if no env var is set? We use the default location(s)! */
if (pdirs_env == NULL)
- pdirs_env = GTR_PLUGINDIR;
+ pdirs_env=GTR_PLUGINDIR;
+
+ /* FIXME, workaround to avoid enviroment variables on windows */
+#ifdef G_OS_WIN32
+ pdirs_env = gtranslator_utils_get_win32_plugindir();
+#endif
DEBUG_PRINT ( "GTR_PLUGINS_PATH=%s", pdirs_env);
pdirs = g_strsplit (pdirs_env, G_SEARCHPATH_SEPARATOR_S, 0);
diff --git a/src/utils.c b/src/utils.c
index 35a7fa7..45a98b6 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1064,3 +1064,33 @@ gtranslator_utils_get_datadir (void)
return path;
}
+
+/**
+ * gtranslator_utils_get_win32_plugindir:
+ *
+ * Returns the path to the GTR_PLUGINDIR folder on windows
+ */
+
+gchar *
+gtranslator_utils_get_win32_plugindir (void)
+{
+ gchar *path;
+
+#ifndef G_OS_WIN32
+ path = NULL;
+#else
+ gchar *win32_dir;
+
+ win32_dir = g_win32_get_package_installation_directory_of_module (NULL);
+
+ path = g_build_filename (win32_dir,
+ "lib",
+ "gtranslator",
+ "plugins",
+ NULL);
+
+ g_free (win32_dir);
+#endif
+
+ return path;
+}
diff --git a/src/utils.h b/src/utils.h
index 1a87635..1ae9dec 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -98,4 +98,5 @@ gchar *gtranslator_utils_get_file_from_pkgdatadir (gchar *filename);
gchar *gtranslator_utils_get_datadir (void);
+gchar *gtranslator_utils_get_win32_plugindir (void);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]