From 8fe0fc2984f12ca81a14f9c0332f60fbbc2d73e3 Mon Sep 17 00:00:00 2001 From: zx Date: Sun, 15 Sep 2024 15:16:43 -0400 Subject: [PATCH] fix: plist changing operations (#3) lol, this is so fucking stupid, i was trying to fix #3 but also found that `Plist.change()` was being used incorrectly EVERYWHERE in cyan, LMAO slight oversight since i forgot i had even changed its usage, but at least it's fixed now --- cyan/logic.py | 2 +- cyan/tbhtypes/plist.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cyan/logic.py b/cyan/logic.py index 1d0095a..3286391 100644 --- a/cyan/logic.py +++ b/cyan/logic.py @@ -86,6 +86,6 @@ def main(parser: ArgumentParser) -> None: if os.path.isdir(args.o): shutil.rmtree(args.o) - shutil.move(app_path, args.o) + shutil.move(app.path, args.o) print(f"[*] generated app at {args.o}") diff --git a/cyan/tbhtypes/plist.py b/cyan/tbhtypes/plist.py index 5cb045b..9da0344 100644 --- a/cyan/tbhtypes/plist.py +++ b/cyan/tbhtypes/plist.py @@ -44,6 +44,7 @@ class Plist: try: if all(self[key] == val for key in keys): return False + raise KeyError # lets pretend this was always here.. except KeyError: for key in keys: self[key] = val @@ -67,15 +68,14 @@ class Plist: print("[?] documents support was already enabled") def change_name(self, name: str) -> None: - if self.change("CFBundleName", "CFBundleDisplayName", name): + if self.change(name, "CFBundleName", "CFBundleDisplayName"): print(f"[*] changed name to \"{name}\"") changed = 0 for lproj in glob(f"{self.app_path}/*.lproj"): try: pl = Plist(f"{lproj}/InfoPlist.strings", None, False) - pl["CFBundleDisplayName"] = name - pl["CFBundleName"] = name + pl.change(name, "CFBundleName", "CFBundleDisplayName") pl.save() changed += 1 except Exception: @@ -87,7 +87,7 @@ class Plist: print(f"[?] name was already \"{name}\"") def change_version(self, version: str) -> None: - if self.change("CFBundleVersion", "CFBundleShortVersionString", version): + if self.change(version, "CFBundleVersion", "CFBundleShortVersionString"): print(f"[*] changed version to \"{version}\"") else: print(f"[?] version was already \"{version}\"") @@ -95,7 +95,7 @@ class Plist: def change_bundle_id(self, bundle_id: str) -> None: orig = self["CFBundleIdentifier"] - if self.change("CFBundleIdentifier", bundle_id): + if self.change(bundle_id, "CFBundleIdentifier"): print(f"[*] changed bundle id to \"{bundle_id}\"") changed = 0 @@ -116,7 +116,7 @@ class Plist: print(f"[?] bundle id was already \"{bundle_id}\"") def change_minimum_version(self, minimum: str) -> None: - if self.change("MinimumOSVersion", minimum): + if self.change(minimum, "MinimumOSVersion"): print(f"[*] changed minimum version to \"{minimum}\"") else: print(f"[?] minimum version was already \"{minimum}\"")