@@ -575,25 +575,27 @@ def _map_cache_files(self):
575575 """
576576 data_path = Path (self .dataDirectory ().absolutePath ())
577577 overwrite_path = Path (self ._organizer .overwritePath ())
578- cache_files = [
579- file .relative_to (data_path ) for file in data_path .glob ("r6/cache/*" )
580- ]
578+ data_cache_path = data_path / "r6/cache"
579+ overwrite_cache_path = overwrite_path / "r6/cache"
580+ cache_files = (
581+ file .relative_to (data_path ) for file in data_cache_path .glob ("*" )
582+ )
581583 if self ._get_setting ("clear_cache_after_game_update" ) and any (
582584 self ._is_cache_file_updated (file , data_path ) for file in cache_files
583585 ):
584586 qInfo ('Updated game files detected, clearing "overwrite/r6/cache/*"' )
585587 try :
586- shutil .rmtree (overwrite_path / "r6/cache" )
588+ shutil .rmtree (overwrite_cache_path )
587589 except FileNotFoundError :
588590 pass
589- new_cache_files = cache_files
591+ qInfo ('Updating "r6/cache" in overwrite' )
592+ shutil .copytree (data_cache_path , overwrite_cache_path , dirs_exist_ok = True )
590593 else :
591- new_cache_files = list (self ._unmapped_cache_files (data_path ))
592- for file in new_cache_files :
593- qInfo (f'Copying "{ file } " to overwrite (to catch file overwrites)' )
594- dst = overwrite_path / file
595- dst .parent .mkdir (parents = True , exist_ok = True )
596- shutil .copy2 (data_path / file , dst )
594+ for file in self ._unmapped_cache_files (data_path ):
595+ qInfo (f'Copying "{ file } " to overwrite (to catch file overwrites)' )
596+ dst = overwrite_path / file
597+ dst .parent .mkdir (parents = True , exist_ok = True )
598+ shutil .copy2 (data_path / file , dst )
597599
598600 def _is_cache_file_updated (self , file : Path , data_path : Path ) -> bool :
599601 """Checks if a cache file is updated (in game dir).
0 commit comments