aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2008-03-03 23:43:49 +0800
committerTor Lillqvist <tml@src.gnome.org>2008-03-03 23:43:49 +0800
commitdd1c89db4520d13312f247585983c87dbfeb9a0e (patch)
tree53d34a57751d1f894c36ad1c2f13e7b6fb0cec0a /shell/main.c
parentcecb32f104fb9a218ede9f82bedf8ca16b9c5a90 (diff)
downloadgsoc2013-evolution-dd1c89db4520d13312f247585983c87dbfeb9a0e.tar.gz
gsoc2013-evolution-dd1c89db4520d13312f247585983c87dbfeb9a0e.tar.zst
gsoc2013-evolution-dd1c89db4520d13312f247585983c87dbfeb9a0e.zip
On Windows, set PATH to include Evolution's "bin" folder and the
2008-03-03 Tor Lillqvist <tml@novell.com> * main.c: On Windows, set PATH to include Evolution's "bin" folder and the "lib/evolution/$(BASE_VERSION)/components" folder. Set BONOBO_ACTIVATION_PATH to the "lib/bonobo/servers" folder svn path=/trunk/; revision=35121
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/shell/main.c b/shell/main.c
index 5a81cdd905..6513e8a161 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -25,6 +25,11 @@
#include <glib.h>
#include <glib/gstdio.h>
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
#include "e-util/e-dialog-utils.h"
#include "e-util/e-bconf-map.h"
@@ -549,7 +554,7 @@ setup_segv_redirect (void)
}
#else
-#define setup_segv_redirect() 0
+#define setup_segv_redirect() (void)0
#endif
static gint
@@ -591,6 +596,61 @@ static const GOptionEntry options[] = {
{ NULL }
};
+#ifdef G_OS_WIN32
+static void
+set_paths (void)
+{
+ /* Set PATH to include the Evolution executable's folder
+ * and the lib/evolution/$(BASE_VERSION)/components folder.
+ */
+ wchar_t exe_filename[MAX_PATH];
+ wchar_t *p;
+ gchar *exe_folder_utf8;
+ gchar *components_folder_utf8;
+ gchar *top_folder_utf8;
+ gchar *path;
+
+ GetModuleFileNameW (NULL, exe_filename, G_N_ELEMENTS (exe_filename));
+
+ p = wcsrchr (exe_filename, L'\\');
+ g_assert (p != NULL);
+
+ *p = L'\0';
+ exe_folder_utf8 = g_utf16_to_utf8 (exe_filename, -1, NULL, NULL, NULL);
+
+ p = wcsrchr (exe_filename, L'\\');
+ g_assert (p != NULL);
+
+ *p = L'\0';
+ top_folder_utf8 = g_utf16_to_utf8 (exe_filename, -1, NULL, NULL, NULL);
+ components_folder_utf8 =
+ g_strconcat (top_folder_utf8,
+ "/lib/evolution/" BASE_VERSION "/components",
+ NULL);
+
+ path = g_build_path (";",
+ exe_folder_utf8,
+ components_folder_utf8,
+ g_getenv ("PATH"),
+ NULL);
+ if (!g_setenv ("PATH", path, TRUE))
+ g_warning ("Could not set PATH for Evolution and its child processes");
+
+ g_free (path);
+
+ /* Set BONOBO_ACTIVATION_PATH */
+ if (g_getenv ("BONOBO_ACTIVATION_PATH" ) == NULL) {
+ path = g_build_filename (top_folder_utf8,
+ "lib/bonobo/servers",
+ NULL);
+ if (!g_setenv ("BONOBO_ACTIVATION_PATH", path, TRUE))
+ g_warning ("Could not set BONOBO_ACTIVATION_PATH");
+ g_free (path);
+ }
+ g_free (top_folder_utf8);
+}
+#endif
+
int
main (int argc, char **argv)
{
@@ -643,6 +703,7 @@ main (int argc, char **argv)
#ifdef G_OS_WIN32
gtk_rc_parse_string ("gtk-fallback-icon-theme = \"gnome\"");
+ set_paths ();
#endif
client = gconf_client_get_default ();