[gedit-latex] Support running from srcdir
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Support running from srcdir
- Date: Wed, 29 Jun 2011 14:08:20 +0000 (UTC)
commit 98a0291e1b1ebdf1a285728fafc2fb149040526b
Author: John Stowers <john stowers gmail com>
Date: Thu Jun 30 02:07:34 2011 +1200
Support running from srcdir
latex/base/appactivatable.py | 19 ++++++++++++-------
latex/base/resources.py | 2 +-
2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/latex/base/appactivatable.py b/latex/base/appactivatable.py
index 0875ac3..aae3a5b 100644
--- a/latex/base/appactivatable.py
+++ b/latex/base/appactivatable.py
@@ -16,13 +16,11 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import sys
-import os
-
-import glib
+import os.path
+import platform
-from gi.repository import Gedit, GObject
+from gi.repository import GLib, Gedit, GObject
from resources import Resources
-import platform
class LaTeXAppActivatable(GObject.Object, Gedit.AppActivatable):
__gtype_name__ = "GeditLaTeXAppActivatable"
@@ -36,8 +34,15 @@ class LaTeXAppActivatable(GObject.Object, Gedit.AppActivatable):
if platform.platform() == 'Windows':
latexdir = os.path.expanduser('~/gedit/latex')
else:
- latexdir = os.path.join(glib.get_user_config_dir(), 'gedit/latex')
+ latexdir = os.path.join(GLib.get_user_config_dir(), 'gedit/latex')
+
+ #check if running from srcdir and if so, prefer that for all data files
+ me = os.path.realpath(os.path.dirname(__file__))
+ if os.path.exists(os.path.join(me, "..", "..", "configure.ac")):
+ sysdir = os.path.abspath(os.path.join(me, "..", "..", "data"))
+ else:
+ sysdir = self.plugin_info.get_data_dir()
- Resources().set_dirs(latexdir, self.plugin_info.get_data_dir())
+ Resources().set_dirs(latexdir, sysdir)
# vi:ex:ts=4:et
diff --git a/latex/base/resources.py b/latex/base/resources.py
index bbe2efd..5735248 100644
--- a/latex/base/resources.py
+++ b/latex/base/resources.py
@@ -24,7 +24,7 @@ base.resources
"""
import logging
-import os
+import os.path
import errno
_log = logging.getLogger("resources")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]