|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 | import os |
15 | | -from time import sleep |
16 | 15 | from os.path import join, dirname, expanduser, exists |
| 16 | +from time import sleep |
17 | 17 |
|
18 | 18 | import xdg.BaseDirectory |
19 | 19 |
|
20 | | -from mycroft.configuration.ovos import get_ovos_config |
| 20 | +from ovos_utils.configuration import get_ovos_config, get_xdg_config_locations |
21 | 21 |
|
22 | 22 | # check for path overrides |
23 | 23 | _ovos_cfg = get_ovos_config() |
24 | | -BASE_FOLDER = _ovos_cfg["base_folder"] |
25 | | -CONFIG_FILE_NAME = _ovos_cfg["config_filename"] |
26 | | -DEFAULT_CONFIG = _ovos_cfg["default_config_path"] or \ |
27 | | - join(dirname(__file__), CONFIG_FILE_NAME) |
28 | 24 |
|
| 25 | +DEFAULT_CONFIG = _ovos_cfg["default_config_path"] or \ |
| 26 | + join(dirname(__file__), "mycroft.conf") |
29 | 27 | SYSTEM_CONFIG = os.environ.get('MYCROFT_SYSTEM_CONFIG', |
30 | | - f'/etc/{BASE_FOLDER}/{CONFIG_FILE_NAME}') |
| 28 | + f'/etc/{_ovos_cfg["base_folder"]}/{_ovos_cfg["config_filename"]}') |
31 | 29 | # TODO: remove in 22.02 |
32 | 30 | # Make sure we support the old location still |
33 | 31 | # Deprecated and will be removed eventually |
34 | | -OLD_USER_CONFIG = join(expanduser('~'), '.' + BASE_FOLDER, CONFIG_FILE_NAME) |
35 | | -USER_CONFIG = join(xdg.BaseDirectory.xdg_config_home, BASE_FOLDER, CONFIG_FILE_NAME) |
| 32 | +OLD_USER_CONFIG = join(expanduser('~'), '.' + _ovos_cfg["base_folder"], _ovos_cfg["config_filename"]) |
| 33 | +USER_CONFIG = join(xdg.BaseDirectory.xdg_config_home, _ovos_cfg["base_folder"], _ovos_cfg["config_filename"]) |
36 | 34 | REMOTE_CONFIG = "mycroft.ai" |
37 | 35 | WEB_CONFIG_CACHE = os.environ.get('MYCROFT_WEB_CACHE') or \ |
38 | | - join(xdg.BaseDirectory.xdg_config_home, BASE_FOLDER, 'web_cache.json') |
39 | | - |
40 | | - |
41 | | -def get_xdg_config_locations(): |
42 | | - # This includes both the user config and |
43 | | - # /etc/xdg/mycroft/mycroft.conf |
44 | | - xdg_paths = list(reversed( |
45 | | - [join(p, CONFIG_FILE_NAME) |
46 | | - for p in xdg.BaseDirectory.load_config_paths(BASE_FOLDER)] |
47 | | - )) |
48 | | - return xdg_paths |
| 36 | + join(xdg.BaseDirectory.xdg_config_home, _ovos_cfg["base_folder"], 'web_cache.json') |
49 | 37 |
|
50 | 38 |
|
51 | 39 | def __ensure_folder_exists(path): |
|
0 commit comments