comparison src/core/constants.py @ 930:cbf4122baae7

core, memory: use XDG recommended paths as the defaults for the config and local directories
author souliane <souliane@mailoo.org>
date Sun, 23 Mar 2014 22:43:43 +0100
parents d609581bf74a
children 598fc223cf59
comparison
equal deleted inserted replaced
929:059b56cbd247 930:cbf4122baae7
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 import os.path
21 from xdg import BaseDirectory
22
20 23
21 class Const(object): 24 class Const(object):
22 APP_NAME = u'Salut à Toi' 25 APP_NAME = u'Salut à Toi'
23 APP_NAME_SHORT = u'SàT' 26 APP_NAME_SHORT = u'SàT'
24 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) 27 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME)
25 APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions 28 APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions
26 29
27 DEFAULT_CONFIG = { 30 DEFAULT_CONFIG = {
28 'local_dir': '~/.sat',
29 'media_dir': '/usr/share/sat/media', 31 'media_dir': '/usr/share/sat/media',
32 'pid_dir': '/tmp',
33 'log_dir': BaseDirectory.save_data_path('sat'),
30 } 34 }
35
36 # XXX: tmp update code, will be removed in the future
37 # When you remove this, please add that in DEFAULT_CONFIG:
38 # 'local_dir': BaseDirectory.save_data_path('sat'),
39 # and also remove sat.memory.memory.Memory.__fixLocalDir
40 DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat')
41
42 # List of the configuration filenames sorted by ascending priority
43 CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \
44 ['/etc/', '~/', '~/.', '', '.'] + \
45 ['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))]
46 ]
31 47
32 NO_SECURITY_LIMIT = -1 48 NO_SECURITY_LIMIT = -1
33 INDIVIDUAL = "individual" 49 INDIVIDUAL = "individual"
34 GENERAL = "general" 50 GENERAL = "general"
35 SAVEFILE_DATABASE = "sat.db" 51 SAVEFILE_DATABASE = "sat.db"