original tracks are now moved to original-tracks in the .cache

This commit is contained in:
Faraphel 2022-07-18 13:17:15 +02:00
parent 8d0544a084
commit 63cbe06bf3
2 changed files with 17 additions and 1 deletions

View file

@ -23,11 +23,21 @@ class ExtractedGame:
"""
Extract all the autoadd files from the game to destination_path
:param destination_path: directory where the autoadd files will be extracted
:return: directory where the autoadd files were extracted
"""
yield {"description": "Extracting autoadd files...", "determinate": False}
szs.autoadd(self.path / "files/Race/Course/", destination_path)
def extract_original_tracks(self, destination_path: "Path | str") -> Generator[dict, None, None]:
"""
Move all the original tracks to the destination path
:param destination_path: destination of the track
"""
destination_path = Path(destination_path)
destination_path.mkdir(parents=True, exist_ok=True)
yield {"description": "Extracting original tracks...", "determinate": False}
for track_file in (self.path / "files/Race/Course/").glob("*.szs"):
track_file.rename(destination_path / track_file.name)
def install_mystuff(self) -> Generator[dict, None, None]:
"""
Install mystuff directory

View file

@ -104,8 +104,14 @@ class Game:
if not self.is_mkw(): raise NotMKWGameError(self.wit_path.path)
if not self.is_vanilla(): raise NotVanillaError(self.wit_path.path)
# extract the game
yield from self.extract(extracted_game.path)
# prepare the cache
yield from extracted_game.extract_autoadd(cache_directory / "autoadd/")
yield from extracted_game.extract_original_tracks(cache_directory / "original-tracks/")
# patch the game
yield from extracted_game.install_mystuff()
yield from extracted_game.prepare_dol()
yield from extracted_game.install_all_patch(mod_config)