Add lxproxy from Leszek Lesner
[lxde/lxadmin.git] / src / lxproxy / lxproxyconfig.py
1 # -*- coding: utf-8 -*-
2 ### BEGIN LICENSE
3 # Copyright (C) YYYY Leszek Lesner leszek@zevenos.com
4 #This program is free software: you can redistribute it and/or modify it
5 #under the terms of the GNU General Public License version 3, as published
6 #by the Free Software Foundation.
7 #
8 #This program is distributed in the hope that it will be useful, but
9 #WITHOUT ANY WARRANTY; without even the implied warranties of
10 #MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 #PURPOSE. See the GNU General Public License for more details.
12 #
13 #You should have received a copy of the GNU General Public License along
14 #with this program. If not, see <http://www.gnu.org/licenses/>.
15 ### END LICENSE
16
17 # THIS IS Lxproxy CONFIGURATION FILE
18 # YOU CAN PUT THERE SOME GLOBAL VALUE
19 # Do not touch until you know what you're doing.
20 # you're warned :)
21
22 # where your project will head for your data (for instance, images and ui files)
23 # by default, this is ../data, relative your trunk layout
24 __lxproxy_data_directory__ = '../data/'
25
26
27 import os
28
29 class project_path_not_found(Exception):
30 pass
31
32 def getdatapath():
33 """Retrieve lxproxy data path
34
35 This path is by default <lxproxy_lib_path>/../data/ in trunk
36 and /usr/share/lxproxy in an installed version but this path
37 is specified at installation time.
38 """
39
40 # get pathname absolute or relative
41 if __lxproxy_data_directory__.startswith('/'):
42 pathname = __lxproxy_data_directory__
43 else:
44 pathname = os.path.dirname(__file__) + '/' + __lxproxy_data_directory__
45
46 abs_data_path = os.path.abspath(pathname)
47 if os.path.exists(abs_data_path):
48 return abs_data_path
49 else:
50 raise project_path_not_found
51