diff --git a/.gitignore b/.gitignore index 05931d7..2df8f60 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ cave_story_randomizer.egg-info/ */__pycache__ caver/version.py + +pre_edited_cs/data/Stage/_version.txt + +pre_edited_cs/freeware/window.rect diff --git a/caver/patcher.py b/caver/patcher.py index 5a7f4dc..8be433a 100644 --- a/caver/patcher.py +++ b/caver/patcher.py @@ -11,9 +11,6 @@ import platform as pl import pre_edited_cs - -CSVERSION = 5 - class CaverException(Exception): pass @@ -67,8 +64,16 @@ def patch_files(patch_data: dict, output_dir: Path, platform: CSPlatform, progre def ensure_base_files_exist(platform: CSPlatform, output_dir: Path): internal_copy = pre_edited_cs.get_path() + with internal_copy.joinpath("data", "Stage", "_version.txt").open() as version_file: + latest_version = version_file.readline() + version = output_dir.joinpath("data", "Stage", "_version.txt") - keep_existing_files = version.exists() and int(version.read_text()) >= CSVERSION + current_version = "v0.0.0.0" + if version.exists(): + with version.open() as version_file: + current_version = version_file.readline() + + keep_existing_files = current_version >= latest_version def should_ignore(path: str, names: list[str]): base = ["__init__.py", "__pycache__", "ScriptSource", "__pyinstaller"] diff --git a/pre_edited_cs/data/Stage/_version.txt b/pre_edited_cs/data/Stage/_version.txt deleted file mode 100644 index e440e5c..0000000 --- a/pre_edited_cs/data/Stage/_version.txt +++ /dev/null @@ -1 +0,0 @@ -3 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fa7d672..2346ec6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,5 +3,6 @@ requires = ["setuptools>=44.0.0", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] +version_file_template = "v{version_tuple[0]}.{version_tuple[1]}.{version_tuple[2]}.{scm_version.distance}\n2019/03/07 - {scm_version.node_date.year:04}/{scm_version.node_date.month:02}/{scm_version.node_date.day:02}\nduncathan_salt" local_scheme = "no-local-version" -write_to = "caver/version.py" +version_file = "pre_edited_cs/data/Stage/_version.txt"