diff --git a/pykotor/tslpatcher/config.py b/pykotor/tslpatcher/config.py index 30cb8742f..459924955 100644 --- a/pykotor/tslpatcher/config.py +++ b/pykotor/tslpatcher/config.py @@ -276,21 +276,20 @@ def should_patch( action = patch.action if hasattr(patch, "action") else "Patch " if replace_file and exists: - if capsule: + if capsule is not None: self.log.add_note(f"{action[:-1]}ing '{patch.filename}' and replacing existing resource in the '{local_folder}' archive") else: self.log.add_note(f"{action[:-1]}ing '{patch.filename}' and replacing existing file in the '{local_folder}' folder") elif no_replacefile_check and exists: - if capsule: + if capsule is not None: self.log.add_note(f"{action[:-1]}ing existing resource '{patch.filename}' in the '{local_folder}' archive") else: self.log.add_note(f"{action[:-1]}ing existing file '{patch.filename}' in the '{local_folder}' folder") elif is_replaceable and exists: - if capsule and not capsule._path.exists(): - self.log.add_error(f"The capsule '{patch.destination}' did not exist when attempting to {action.lower()} '{patch.filename}'. Skipping file...") - else: - self.log.add_warning(f"'{patch.filename}' already exists in the '{local_folder}' {container_type}. Skipping file...") + self.log.add_warning(f"'{patch.filename}' already exists in the '{local_folder}' {container_type}. Skipping file...") return False + elif capsule is not None and not capsule._path.exists(): + self.log.add_error(f"The capsule '{patch.destination}' did not exist when attempting to {action.lower().rstrip()} '{patch.filename}'. Skipping file...") else: self.log.add_note(f"{action[:-1]}ing '{patch.filename}' and {'adding' if capsule else 'saving'} to the '{local_folder}' {container_type}") return True