Skip to content

Commit

Permalink
Fix cyberpunk cache file sync after game update (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZashIn authored Feb 13, 2024
1 parent 47fc574 commit d3997af
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions games/game_cyberpunk2077.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def _onAboutToRun(self, app_path_str: str, wd: QDir, args: str) -> bool:
qWarning("Aborting game launch.")
return False # Auto deploy failed
self._map_cache_files()
return False
if self._get_setting("enforce_archive_load_order"):
self._modlist_files.update_modlist("archive")
return True
Expand Down Expand Up @@ -546,10 +547,11 @@ def _map_cache_files(self):
"""
data_path = Path(self.dataDirectory().absolutePath())
overwrite_path = Path(self._organizer.overwritePath())
cache_files = list(data_path.glob("r6/cache/*"))
cache_files = [
file.relative_to(data_path) for file in data_path.glob("r6/cache/*")
]
if self._get_setting("clear_cache_after_game_update") and any(
self._is_cache_file_updated(file.relative_to(data_path), data_path)
for file in cache_files
self._is_cache_file_updated(file, data_path) for file in cache_files
):
qInfo('Updated game files detected, clearing "overwrite/r6/cache/*"')
shutil.rmtree(overwrite_path / "r6/cache")
Expand Down

0 comments on commit d3997af

Please sign in to comment.