diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2007-05-15 09:50:21 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2007-05-15 09:50:21 (GMT) |
commit | 4a8493f95e4df95cfbdb0705c146342f4b8cab58 (patch) | |
tree | 0da16771645aa3fdf6e2ba32ba1ce14eec694383 | |
parent | 9fa0790c2be829bcd652a49ed9c6e52989dcbfe7 (diff) |
Fix mozilla components loading when sugar is running from source.
We don't attempt to load components from source, since that would
be insanely complicated.
-rw-r--r-- | bin/sugar.in | 1 | ||||
-rw-r--r-- | browser/sugar-browser.cpp | 12 | ||||
-rw-r--r-- | sugar/env.py | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/bin/sugar.in b/bin/sugar.in index 41ed77b..36a8e2b 100644 --- a/bin/sugar.in +++ b/bin/sugar.in @@ -1,3 +1,4 @@ +export SUGAR_PREFIX=@prefix@ export SUGAR_PATH=@prefix@/share/sugar export GTK2_RC_FILES=@prefix@/share/sugar/data/sugar-xo.gtkrc dbus-launch --exit-with-session sugar-shell diff --git a/browser/sugar-browser.cpp b/browser/sugar-browser.cpp index d64224f..d5644da 100644 --- a/browser/sugar-browser.cpp +++ b/browser/sugar-browser.cpp @@ -159,13 +159,23 @@ sugar_browser_startup(const char *profile_path, const char *profile_name) old_handler = XSetErrorHandler(error_handler); + const char *prefix = g_getenv("SUGAR_PREFIX"); + if (prefix == NULL) { + g_print("The SUGAR_PREFIX environment variable is not set."); + exit(1); + } + + char *components_path = g_build_filename(prefix, "share/sugar", NULL); + GeckoDirectoryProvider *dirProvider = - new GeckoDirectoryProvider(g_getenv(SUGAR_PATH)); + new GeckoDirectoryProvider(components_path); if (!dirProvider) { g_warning ("failed to create GeckoDirectoryProvider"); return FALSE; } + g_free(components_path); + NS_ADDREF (dirProvider); nsCOMPtr<nsIDirectoryServiceProvider> dp (do_QueryInterface (dirProvider)); diff --git a/sugar/env.py b/sugar/env.py index 4bee509..03cfea7 100644 --- a/sugar/env.py +++ b/sugar/env.py @@ -22,7 +22,7 @@ def _get_prefix_path(base, path=None): if os.environ.has_key('SUGAR_PREFIX'): prefix = os.environ['SUGAR_PREFIX'] else: - prefix = '/usr' + raise RuntimeError("The SUGAR_PREFIX environment variable is not set.") if path: return os.path.join(prefix, base, path) |