Skip to content

Commit

Permalink
patcher - don't show saveas filename in output unless it differs
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Nov 7, 2023
1 parent 6a54485 commit 7aacf48
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pykotor/tslpatcher/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ def backup(self) -> tuple[CaseAwarePath, set]:
return (self._backup, self._processed_backup_files)

def handle_capsule_and_backup(
self, patch: PatcherModifications, output_container_path: CaseAwarePath
self,
patch: PatcherModifications,
output_container_path: CaseAwarePath,
) -> tuple[bool, Capsule | None]:
capsule = None
if is_capsule_file(patch.destination):
Expand Down Expand Up @@ -304,7 +306,8 @@ def should_patch(
# In capsules, I haven't seen any TSLPatcher mods reach this point. I know TSLPatcher at least supports this portion for non-capsules.
# Most mods will use an [InstallList] to ensure the files exist in the game path before patching anyways, but not all.
save_type: str = "adding" if capsule is not None else "saving"
self.log.add_note(f"{patch.action[:-1]}ing '{patch.sourcefile}' and {save_type} as '{patch.saveas}' to the '{local_folder}' {container_type}")
saving_as_str = f"as '{patch.saveas}' " if patch.saveas != patch.sourcefile else ""
self.log.add_note(f"{patch.action[:-1]}ing '{patch.sourcefile}' and {save_type} {saving_as_str}to the '{local_folder}' {container_type}")
return True

def install(self) -> None:
Expand All @@ -327,7 +330,7 @@ def install(self) -> None:
if not self.should_patch(patch, exists, capsule):
continue
data_to_patch_bytes = self.lookup_resource(patch, output_container_path, exists, capsule)
if data_to_patch_bytes is None: # check None instead of `not data_do_patch_bytes` as sometimes mods will installlist empty files.
if data_to_patch_bytes is None: # check None instead of `not data_to_patch_bytes` as sometimes mods will installlist empty files.
self.log.add_error(f"Could not locate resource to {patch.action.lower().strip()}: '{patch.sourcefile}'")
continue

Expand Down

0 comments on commit 7aacf48

Please sign in to comment.