build: fix version embedding
@ -1,6 +1,6 @@
|
||||
<p align="center">
|
||||
<img alt="TR2X logo" src="tools/resources/logo-light-theme.png#gh-light-mode-only" width="400"/>
|
||||
<img alt="TR2X logo" src="tools/resources/logo-dark-theme.png#gh-dark-mode-only" width="400"/>
|
||||
<img alt="TR2X logo" src="data/logo-light-theme.png#gh-light-mode-only" width="400"/>
|
||||
<img alt="TR2X logo" src="data/logo-dark-theme.png#gh-dark-mode-only" width="400"/>
|
||||
</p>
|
||||
|
||||
TR2X is an open-source decompilation project for Tomb Raider 2, created as a
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
0
tools/generate_init
Normal file → Executable file
22
tools/generate_rcfile
Normal file → Executable file
@ -2,35 +2,32 @@
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
REPO_DIR = Path(__file__).parent.parent
|
||||
RESOURCES_DIR = REPO_DIR / "tools" / "resources"
|
||||
SRC_DIR = REPO_DIR / "src"
|
||||
from shared.common import DATA_DIR
|
||||
from shared.versioning import generate_version
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--version-file", type=Path)
|
||||
parser.add_argument('-o', "--output", type=Path, nargs="+")
|
||||
parser.add_argument("-o", "--output", type=Path, nargs="+")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def write_rc_template(input_path: Path, output_path: Path, version: str) -> None:
|
||||
def write_rc_template(
|
||||
input_path: Path, output_path: Path, version: str
|
||||
) -> None:
|
||||
template = input_path.read_text()
|
||||
template = template.replace("{version}", version)
|
||||
template = template.replace("{icon_path}", str(RESOURCES_DIR / "icon.ico"))
|
||||
template = template.replace("{icon_path}", str(DATA_DIR / "icon.ico"))
|
||||
output_path.write_text(template)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
args = parse_args()
|
||||
if args.version_file and args.version_file.exists():
|
||||
version = args.version_file.read_text().strip()
|
||||
else:
|
||||
version = ""
|
||||
version = generate_version()
|
||||
|
||||
for output_path in args.output:
|
||||
write_rc_template(
|
||||
input_path=RESOURCES_DIR / output_path.name,
|
||||
input_path=DATA_DIR / output_path.name,
|
||||
output_path=output_path,
|
||||
version=version,
|
||||
)
|
||||
@ -38,4 +35,3 @@ def main() -> None:
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|