Mercurial > libervia-backend
comparison sat/core/constants.py @ 2965:121c4a2a567c
core (config): if flatpak is detected, config is also looked after in /app
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 23 Jun 2019 17:40:19 +0200 |
parents | 767e1ef6e1bd |
children | 9a47a8caa280 |
comparison
equal
deleted
inserted
replaced
2964:17c61d09a85b | 2965:121c4a2a567c |
---|---|
207 "/data/data/org.salutatoi.cagou/files/app/android/" | 207 "/data/data/org.salutatoi.cagou/files/app/android/" |
208 + APP_NAME_FILE | 208 + APP_NAME_FILE |
209 + ".conf" | 209 + ".conf" |
210 ] | 210 ] |
211 else: | 211 else: |
212 import os | |
213 CONFIG_PATHS = ( | |
214 ["/etc/", "~/", "~/.", "", "."] | |
215 + [ | |
216 "%s/" % path | |
217 for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE)) | |
218 ] | |
219 ) | |
220 | |
221 if os.getenv('FLATPAK_ID'): | |
222 # for Flatpak, the conf can't be set in /etc or $HOME, so we have | |
223 # to add /app | |
224 CONFIG_PATHS.append('/app') | |
212 | 225 |
213 ## Configuration ## | 226 ## Configuration ## |
214 DEFAULT_CONFIG = { | 227 DEFAULT_CONFIG = { |
215 "media_dir": "/usr/share/" + APP_NAME_FILE + "/media", | 228 "media_dir": "/usr/share/" + APP_NAME_FILE + "/media", |
216 "local_dir": BaseDirectory.save_data_path(APP_NAME_FILE), | 229 "local_dir": BaseDirectory.save_data_path(APP_NAME_FILE), |
220 } | 233 } |
221 | 234 |
222 # List of the configuration filenames sorted by ascending priority | 235 # List of the configuration filenames sorted by ascending priority |
223 CONFIG_FILES = [ | 236 CONFIG_FILES = [ |
224 realpath(expanduser(path) + APP_NAME_FILE + ".conf") | 237 realpath(expanduser(path) + APP_NAME_FILE + ".conf") |
225 for path in ["/etc/", "~/", "~/.", "", "."] | 238 for path in CONFIG_PATHS |
226 + [ | |
227 "%s/" % path | |
228 for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE)) | |
229 ] | |
230 ] | 239 ] |
231 | 240 |
232 ## Templates ## | 241 ## Templates ## |
233 TEMPLATE_TPL_DIR = u"templates" | 242 TEMPLATE_TPL_DIR = u"templates" |
234 TEMPLATE_THEME_DEFAULT = u"default" | 243 TEMPLATE_THEME_DEFAULT = u"default" |