fix(clew): skip existing archive extractions
This commit is contained in:
@@ -70,7 +70,7 @@ def extract_archive(archive: Path, destination: Path) -> None:
|
||||
extract_rpa(handle, output_dir=str(destination))
|
||||
|
||||
|
||||
def extract_game_files(game_root: Path, output_path: Path) -> None:
|
||||
def extract_game_files(game_root: Path, output_path: Path, overwrite: bool) -> None:
|
||||
queue = deque(game_root.iterdir())
|
||||
|
||||
while queue:
|
||||
@@ -81,7 +81,11 @@ def extract_game_files(game_root: Path, output_path: Path) -> None:
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
queue.extend(item.iterdir())
|
||||
elif item.is_file() and item.suffix.lower() == ".rpa":
|
||||
extract_archive(item, destination.with_suffix(""))
|
||||
archive_output = destination.with_suffix("")
|
||||
if archive_output.is_dir() and not overwrite:
|
||||
LOG.info(f"skipping existing archive extraction: {archive_output}")
|
||||
continue
|
||||
extract_archive(item, archive_output)
|
||||
elif item.is_file():
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(item, destination)
|
||||
@@ -178,7 +182,7 @@ def run(args: argparse.Namespace) -> None:
|
||||
raise SystemExit(2)
|
||||
|
||||
extracted = get_output_directory(output_root, "extracted")
|
||||
extract_game_files(game_root, extracted)
|
||||
extract_game_files(game_root, extracted, args.overwrite)
|
||||
|
||||
if not args.no_extract_renpy_ast:
|
||||
ast = get_output_directory(output_root, "ast")
|
||||
|
||||
Reference in New Issue
Block a user