Mercurial > libervia-backend
comparison src/core/constants.py @ 1004:191f440d11b4
core (constants): use realpath instead of abspath + do not import it when building libervia
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 01 May 2014 11:14:25 +0200 |
parents | 52ec79aa5bbe |
children | b4af31a8a4f2 |
comparison
equal
deleted
inserted
replaced
1003:52ec79aa5bbe | 1004:191f440d11b4 |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from os.path import expanduser, abspath | |
21 try: | 20 try: |
22 import __pyjamas__ # do not import xdg when building Libervia | 21 import __pyjamas__ # do not import xdg when building Libervia |
23 BaseDirectory = None | 22 BaseDirectory = None |
24 except ImportError: | 23 except ImportError: |
24 from os.path import expanduser, realpath | |
25 from xdg import BaseDirectory | 25 from xdg import BaseDirectory |
26 | 26 |
27 | 27 |
28 class Const(object): | 28 class Const(object): |
29 | 29 |
60 'pid_dir': '%(local_dir)s', | 60 'pid_dir': '%(local_dir)s', |
61 'log_dir': '%(local_dir)s', | 61 'log_dir': '%(local_dir)s', |
62 } | 62 } |
63 | 63 |
64 # List of the configuration filenames sorted by ascending priority | 64 # List of the configuration filenames sorted by ascending priority |
65 CONFIG_FILES = [abspath(expanduser(path) + APP_NAME_FILE + '.conf') for path in | 65 CONFIG_FILES = [realpath(expanduser(path) + APP_NAME_FILE + '.conf') for path in |
66 ['/etc/', '~/', '~/.', '', '.'] + | 66 ['/etc/', '~/', '~/.', '', '.'] + |
67 ['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))] | 67 ['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))] |
68 ] | 68 ] |
69 | 69 |
70 | 70 |