From 620188a9f086251b9996c43f20f913afb020bb0c Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Wed, 3 Jan 2024 18:41:21 -0500 Subject: [PATCH 1/2] [Fix] Reunify Resource File Locations Running from source and built had these json files in different locations. Fixing to the intended unified spot. --- build.py | 4 ++-- coriolis-update-files.py | 4 ++-- resources/modules.json => modules.json | 0 resources/ships.json => ships.json | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename resources/modules.json => modules.json (100%) rename resources/ships.json => ships.json (100%) diff --git a/build.py b/build.py index e1d37f49..a86689a7 100644 --- a/build.py +++ b/build.py @@ -77,8 +77,8 @@ def generate_data_files( "snd_good.wav", "snd_bad.wav", "modules.p", # TODO: Remove in 6.0 - "resources/modules.json", - "resources/ships.json", + "modules.json", + "ships.json", "ships.p", # TODO: Remove in 6.0 f"{app_name}.VisualElementsManifest.xml", f"{app_name}.ico", diff --git a/coriolis-update-files.py b/coriolis-update-files.py index b68d9647..9c1d7ecc 100755 --- a/coriolis-update-files.py +++ b/coriolis-update-files.py @@ -57,7 +57,7 @@ if __name__ == "__main__": modules['_'.join([reverse_ship_map[name], 'armour', bulkhead])] = {'mass': m['bulkheads'][i]['mass']} ships = OrderedDict([(k, ships[k]) for k in sorted(ships)]) # sort for easier diffing - with open("resources/ships.json", "w") as ships_file: + with open("ships.json", "w") as ships_file: json.dump(ships, ships_file, indent=4) # Module masses @@ -92,5 +92,5 @@ if __name__ == "__main__": add(modules, 'hpt_multicannon_fixed_medium_advanced', {'mass': 4}) modules = OrderedDict([(k, modules[k]) for k in sorted(modules)]) # sort for easier diffing - with open("resources/modules.json", "w") as modules_file: + with open("modules.json", "w") as modules_file: json.dump(modules, modules_file, indent=4) diff --git a/resources/modules.json b/modules.json similarity index 100% rename from resources/modules.json rename to modules.json diff --git a/resources/ships.json b/ships.json similarity index 100% rename from resources/ships.json rename to ships.json From bcb8a4a999afad5ca9766b8b08429f2cd4a9a12b Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Wed, 3 Jan 2024 19:02:15 -0500 Subject: [PATCH 2/2] [Fix] Unify Resources Folder --- edshipyard.py | 2 +- outfitting.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/edshipyard.py b/edshipyard.py index 5d14009c..1660ad7e 100644 --- a/edshipyard.py +++ b/edshipyard.py @@ -24,7 +24,7 @@ __Module = dict[str, Union[str, list[str]]] # Have to keep old-style here for c ship_map = ship_name_map.copy() # Ship masses -ships_file = config.respath_path / "resources" / "ships.json" +ships_file = config.respath_path / "ships.json" with open(ships_file, encoding="utf-8") as ships_file_handle: ships = json.load(ships_file_handle) diff --git a/outfitting.py b/outfitting.py index 3305929c..2bb47c6d 100644 --- a/outfitting.py +++ b/outfitting.py @@ -57,7 +57,7 @@ def lookup(module, ship_map, entitled=False) -> dict | None: # noqa: C901, CCR0 """ # Lazily populate if not moduledata: - modules_path = config.respath_path / "resources" / "modules.json" + modules_path = config.respath_path / "modules.json" moduledata.update(json.loads(modules_path.read_text())) if not module.get('name'):