Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/common/check_paths.py
    ... ... @@ -178,11 +178,8 @@ def split_db():
    178 178
         logger.CACHE_DB_PATH = tmp
    
    179 179
     
    
    180 180
     def check_and_possibly_create_paths():
    
    181
    -    LOG_DB_PATH = logger.LOG_DB_PATH
    
    182
    -    LOG_DB_FOLDER, LOG_DB_FILE = os.path.split(LOG_DB_PATH)
    
    183
    -
    
    184
    -    CACHE_DB_PATH = logger.CACHE_DB_PATH
    
    185
    -    CACHE_DB_FOLDER, CACHE_DB_FILE = os.path.split(CACHE_DB_PATH)
    
    181
    +    LOG_DB_PATH = configpaths.get('LOG_DB')
    
    182
    +    CACHE_DB_PATH = configpaths.get('CACHE_DB')
    
    186 183
     
    
    187 184
         for path in configpaths.get_paths(PathType.FOLDER):
    
    188 185
             if not os.path.exists(path):
    
    ... ... @@ -192,20 +189,6 @@ def check_and_possibly_create_paths():
    192 189
                 print(_('Gajim will now exit'))
    
    193 190
                 sys.exit()
    
    194 191
     
    
    195
    -    if not os.path.exists(LOG_DB_FOLDER):
    
    196
    -        create_path(LOG_DB_FOLDER)
    
    197
    -    elif os.path.isfile(LOG_DB_FOLDER):
    
    198
    -        print(_('%s is a file but it should be a directory') % LOG_DB_FOLDER)
    
    199
    -        print(_('Gajim will now exit'))
    
    200
    -        sys.exit()
    
    201
    -
    
    202
    -    if not os.path.exists(CACHE_DB_FOLDER):
    
    203
    -        create_path(CACHE_DB_FOLDER)
    
    204
    -    elif os.path.isfile(CACHE_DB_FOLDER):
    
    205
    -        print(_('%s is a file but it should be a directory') % CACHE_DB_FOLDER)
    
    206
    -        print(_('Gajim will now exit'))
    
    207
    -        sys.exit()
    
    208
    -
    
    209 192
         if not os.path.exists(LOG_DB_PATH):
    
    210 193
             if os.path.exists(CACHE_DB_PATH):
    
    211 194
                 os.remove(CACHE_DB_PATH)
    

  • gajim/common/configpaths.py
    ... ... @@ -124,7 +124,7 @@ class ConfigPaths:
    124 124
             return path
    
    125 125
     
    
    126 126
         def _add(self, name, path, location=None, path_type=None, unique=False):
    
    127
    -        if location is not None:
    
    127
    +        if path and location is not None:
    
    128 128
                 path = self._prepare(path, unique)
    
    129 129
             self._paths[name] = (location, path, path_type)
    
    130 130
     
    
    ... ... @@ -135,9 +135,9 @@ class ConfigPaths:
    135 135
     
    
    136 136
             user_dir_paths = [
    
    137 137
                 ('TMP', tempfile.gettempdir()),
    
    138
    -            ('MY_CONFIG', self.config_root),
    
    139
    -            ('MY_CACHE', self.cache_root),
    
    140
    -            ('MY_DATA', self.data_root),
    
    138
    +            ('MY_CONFIG', '', PathLocation.CONFIG, PathType.FOLDER),
    
    139
    +            ('MY_CACHE', '', PathLocation.CACHE, PathType.FOLDER),
    
    140
    +            ('MY_DATA', '', PathLocation.DATA, PathType.FOLDER),
    
    141 141
             ]
    
    142 142
     
    
    143 143
             for path in user_dir_paths: