-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.py
More file actions
47 lines (33 loc) · 1.2 KB
/
Copy pathsettings.py
File metadata and controls
47 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
from os.path import join, realpath, normpath
from storage.config import Config
def path(first: str, *other):
return normpath(join(first, *other))
VERSION = '0.5.2'
USER_DIR = os.path.expanduser('~')
AC_DOC_DIR = path(USER_DIR, 'Documents', 'Assetto Corsa')
ACLIB_DOC_DIR = path(AC_DOC_DIR, 'ACLIB')
ACLIB_INSTALL_DIR = path(realpath(__file__), '..', '..')
AC_INSTALL_DIR = path(ACLIB_INSTALL_DIR, '..', '..', '..')
AC_CONTENT_DIR = path(AC_INSTALL_DIR, 'content')
AC_CAR_DIR = path(AC_CONTENT_DIR, 'cars')
AC_TRACK_DIR = path(AC_CONTENT_DIR, 'tracks')
APP_DIR = path(ACLIB_INSTALL_DIR, 'apps')
RESOURCE_DIR = path(ACLIB_INSTALL_DIR, 'resources')
TEXTURE_DIR = path(RESOURCE_DIR, 'textures')
LANGUAGE_DIR = path(RESOURCE_DIR, 'languages')
CONFIG_DIR = path(ACLIB_DOC_DIR, 'config')
METADATA_DIR = path(ACLIB_DOC_DIR, 'metadata')
STYLE_DIR = path(ACLIB_DOC_DIR, 'style')
CONFIG = Config(path(CONFIG_DIR, 'ACLIB.ini'))
def get(key: str):
return CONFIG.get(key)
def get_or_set(key: str, value):
result = get(key)
if not result:
CONFIG.set(key, value)
return value
return result
get_or_set('write_acd', True)
get_or_set('write_meta', False)
get_or_set('log_to_AC', False)