From a02de3c01ad8ad9c1c66b01a99e379cc5431fa2c Mon Sep 17 00:00:00 2001 From: duncathan Date: Wed, 8 Dec 2021 01:04:06 -0600 Subject: [PATCH] ok I swear this'll be the last one tonight --- .../{hook-pre-edited-cs.py => hook-pre_edited_cs.py} | 0 caver/patcher.py | 10 +++------- pre_edited_cs/__init__.py | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) rename __pyinstaller/{hook-pre-edited-cs.py => hook-pre_edited_cs.py} (100%) diff --git a/__pyinstaller/hook-pre-edited-cs.py b/__pyinstaller/hook-pre_edited_cs.py similarity index 100% rename from __pyinstaller/hook-pre-edited-cs.py rename to __pyinstaller/hook-pre_edited_cs.py diff --git a/caver/patcher.py b/caver/patcher.py index 871387f..c7cb089 100644 --- a/caver/patcher.py +++ b/caver/patcher.py @@ -18,8 +18,8 @@ def get_path() -> Path: if getattr(sys, "frozen", False): file_dir = Path(getattr(sys, "_MEIPASS")) else: - file_dir = Path(__file__).parent - return file_dir + file_dir = Path(__file__).parent.parent + return file_dir.joinpath("caver") def patch_files(patch_data: dict, output_dir: Path, progress_update: Callable[[str, float], None]): progress_update("Copying base files...", -1) @@ -54,11 +54,7 @@ def ensure_base_files_exist(output_dir: Path): return base try: - shutil.copytree(internal_copy.joinpath("data"), output_dir.joinpath("data"), ignore=should_ignore, dirs_exist_ok=True) - root_files = ["Doukutsu.exe", "DoConfig.exe", "Config.dat"] - root_files = [f for f in root_files if not f in should_ignore(str(output_dir), root_files)] - for f in root_files: - shutil.copyfile(internal_copy.joinpath(f), output_dir.joinpath(f)) + shutil.copytree(internal_copy, output_dir, ignore=should_ignore, dirs_exist_ok=True) except shutil.Error: raise CaverException("Error copying base files. Ensure the directory is not read-only, and that Doukutsu.exe is closed.") output_dir.joinpath("data", "Plaintext").mkdir(exist_ok=True) diff --git a/pre_edited_cs/__init__.py b/pre_edited_cs/__init__.py index 5784c3a..910dfe9 100644 --- a/pre_edited_cs/__init__.py +++ b/pre_edited_cs/__init__.py @@ -6,5 +6,5 @@ def get_path() -> Path: if getattr(sys, "frozen", False): file_dir = Path(getattr(sys, "_MEIPASS")) else: - file_dir = Path(__file__).parent - return file_dir + file_dir = Path(__file__).parent.parent + return file_dir.joinpath("pre_edited_cs")