diff --git a/gajim/common/check_paths.py b/gajim/common/check_paths.py index eb83894f6..db9c333ca 100644 --- a/gajim/common/check_paths.py +++ b/gajim/common/check_paths.py @@ -178,11 +178,8 @@ def split_db(): logger.CACHE_DB_PATH = tmp def check_and_possibly_create_paths(): - LOG_DB_PATH = logger.LOG_DB_PATH - LOG_DB_FOLDER, LOG_DB_FILE = os.path.split(LOG_DB_PATH) - - CACHE_DB_PATH = logger.CACHE_DB_PATH - CACHE_DB_FOLDER, CACHE_DB_FILE = os.path.split(CACHE_DB_PATH) + LOG_DB_PATH = configpaths.get('LOG_DB') + CACHE_DB_PATH = configpaths.get('CACHE_DB') for path in configpaths.get_paths(PathType.FOLDER): if not os.path.exists(path): @@ -192,20 +189,6 @@ def check_and_possibly_create_paths(): print(_('Gajim will now exit')) sys.exit() - if not os.path.exists(LOG_DB_FOLDER): - create_path(LOG_DB_FOLDER) - elif os.path.isfile(LOG_DB_FOLDER): - print(_('%s is a file but it should be a directory') % LOG_DB_FOLDER) - print(_('Gajim will now exit')) - sys.exit() - - if not os.path.exists(CACHE_DB_FOLDER): - create_path(CACHE_DB_FOLDER) - elif os.path.isfile(CACHE_DB_FOLDER): - print(_('%s is a file but it should be a directory') % CACHE_DB_FOLDER) - print(_('Gajim will now exit')) - sys.exit() - if not os.path.exists(LOG_DB_PATH): if os.path.exists(CACHE_DB_PATH): os.remove(CACHE_DB_PATH) diff --git a/gajim/common/configpaths.py b/gajim/common/configpaths.py index f657e725e..387145414 100644 --- a/gajim/common/configpaths.py +++ b/gajim/common/configpaths.py @@ -124,7 +124,7 @@ class ConfigPaths: return path def _add(self, name, path, location=None, path_type=None, unique=False): - if location is not None: + if path and location is not None: path = self._prepare(path, unique) self._paths[name] = (location, path, path_type) @@ -135,9 +135,9 @@ class ConfigPaths: user_dir_paths = [ ('TMP', tempfile.gettempdir()), - ('MY_CONFIG', self.config_root), - ('MY_CACHE', self.cache_root), - ('MY_DATA', self.data_root), + ('MY_CONFIG', '', PathLocation.CONFIG, PathType.FOLDER), + ('MY_CACHE', '', PathLocation.CACHE, PathType.FOLDER), + ('MY_DATA', '', PathLocation.DATA, PathType.FOLDER), ] for path in user_dir_paths: