1.1 --- a/OpenSecurity/bin/environment.py Mon May 19 13:13:30 2014 +0200
1.2 +++ b/OpenSecurity/bin/environment.py Thu Jul 17 10:20:10 2014 +0100
1.3 @@ -46,6 +46,7 @@
1.4 """Hold some nifty environment stuff in a dedicated class."""
1.5
1.6 _log_warning_shown = False
1.7 + _prefix_path = ''
1.8
1.9 def __init__(self, application = None):
1.10
1.11 @@ -66,7 +67,13 @@
1.12 if sys.platform == 'linux2':
1.13 self._prefix_path = os.path.split(sys.path[0])[0]
1.14 elif sys.platform == 'win32' or sys.platform == 'cygwin':
1.15 - self._prefix_path = os.path.normpath(os.path.join(sys.path[0], '..'))
1.16 + for app_path in sys.path:
1.17 + if 'OpenSecurity\\bin' in app_path:
1.18 + self._prefix_path = os.path.normpath(os.path.join(app_path, '..'))
1.19 + break
1.20 +
1.21 + if self._prefix_path == '':
1.22 + raise OSError()
1.23
1.24 # the data path where all data files are stored
1.25 if sys.platform == 'linux2':
1.26 @@ -142,7 +149,7 @@
1.27 def test():
1.28
1.29 """Test: class Environment"""
1.30 - e = Environment('My Application')
1.31 + e = Environment('OpenSecurity')
1.32 print('prefix_path: "{0}"'.format(e.prefix_path))
1.33 print(' data_path: "{0}"'.format(e.data_path))
1.34 print(' log_path: "{0}"'.format(e.log_path))