From c6a8af9eb63a76a5196dd99c7525adee88f1af73 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 17 Feb 2015 09:06:54 -0500 Subject: [PATCH] Allow gramps to be used from source, without GRAMPS_RESOURCES env variable --- gramps/gen/utils/resourcepath.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gramps/gen/utils/resourcepath.py b/gramps/gen/utils/resourcepath.py index 4318a7b8f..52fe9faa8 100644 --- a/gramps/gen/utils/resourcepath.py +++ b/gramps/gen/utils/resourcepath.py @@ -49,7 +49,6 @@ class ResourcePath(object): def __init__(self): if self.initialized: return - resource_file = os.path.join(os.path.abspath(os.path.dirname( conv_to_unicode(__file__))), 'resource-path') installed = os.path.exists(resource_file) @@ -76,8 +75,13 @@ class ResourcePath(object): LOG.error("Resource Path %s is invalid", resource_path) sys.exit(1) else: - LOG.error("Unable to determine resource path") - sys.exit(1) + # Let's try to run from source without env['GRAMPS_RESOURCES']: + resource_path = os.path.join(os.path.abspath(os.path.dirname( + conv_to_unicode(__file__))), '..', "..", "..") + test_path = os.path.join("data", "authors.xml") + if (not os.path.exists(os.path.join(resource_path, test_path))): + LOG.error("Unable to determine resource path") + sys.exit(1) if installed: self.locale_dir = os.path.join(resource_path, 'locale')