diff --git a/packaging/check-app-specific.sh b/packaging/check-app-specific.sh index c14ca5725..3b84227f2 100644 --- a/packaging/check-app-specific.sh +++ b/packaging/check-app-specific.sh @@ -22,3 +22,41 @@ for key in ("runtime", "runtime-version", "sdk", "finish-args"): assert manifests[0][key] == manifests[1][key], f"Flatpak manifests disagree on {key}" print("LightCraft package identity ok") PYEOF + +# The macOS bundle must declare only file types LightCraft can open. It used to carry PhotoCraft's +# `.pcraft` document type and imported PSB/QOI declarations, so Launch Services typed PhotoCraft +# documents as LightCraft's and `.pcraft` had three claimant apps (issue #1951). plistlib parses the +# template as a property list too, which is the syntax check package.sh's `plutil -lint` repeats on +# the substituted file. +python3 - <<'PYEOF' +import plistlib +with open("packaging/macos/Info.plist.in", "rb") as source: + plist = plistlib.load(source) +for key, value in { + "CFBundleIdentifier": "ai.storyteller.lightcraft", + "CFBundleExecutable": "LightCraft", + "CFBundleIconFile": "LightCraft", + "LSMinimumSystemVersion": "11.0", +}.items(): + assert plist.get(key) == value, f"Info.plist {key}: {plist.get(key)!r}, expected {value!r}" +for key in ("CFBundleShortVersionString", "CFBundleVersion", "LightCraftVersion", "LightCraftBuildCommit"): + assert plist.get(key), f"Info.plist lost {key}" +declared = set() +for section in ("UTExportedTypeDeclarations", "UTImportedTypeDeclarations"): + for entry in plist.get(section, []): + tags = entry.get("UTTypeTagSpecification", {}) + declared.update(tags.get("public.filename-extension", [])) + declared.update(tags.get("public.mime-type", [])) + declared.add(entry.get("UTTypeIdentifier", "")) +unsupported = {name.lower() for name in declared} & { + "pcraft", + "psb", + "qoi", + "application/x-lightcraft", + "ai.storyteller.lightcraft.document", + "ai.storyteller.lightcraft.qoi", + "com.adobe.photoshop-large-image", +} +assert not unsupported, f"Info.plist declares types LightCraft cannot open: {sorted(unsupported)}" +print("LightCraft macOS bundle types ok") +PYEOF diff --git a/packaging/macos/Info.plist.in b/packaging/macos/Info.plist.in index 03220ab0a..fd87f601e 100644 --- a/packaging/macos/Info.plist.in +++ b/packaging/macos/Info.plist.in @@ -49,66 +49,11 @@ NSHumanReadableCopyright Copyright © the LightCraft authors. MIT OR Apache-2.0. - - UTExportedTypeDeclarations - - - UTTypeIdentifier - ai.storyteller.lightcraft.document - UTTypeDescription - LightCraft Document - UTTypeConformsTo - - public.data - public.image - - UTTypeIconFile - LightCraft - UTTypeTagSpecification - - public.filename-extension - pcraft - public.mime-type - application/x-lightcraft - - - - - UTImportedTypeDeclarations - - - UTTypeIdentifier - com.adobe.photoshop-large-image - UTTypeDescription - Photoshop Large Document - UTTypeConformsTo - - public.data - public.image - - UTTypeTagSpecification - - public.filename-extension - psb - - - - UTTypeIdentifier - ai.storyteller.lightcraft.qoi - UTTypeDescription - QOI Image - UTTypeConformsTo - - public.data - public.image - - UTTypeTagSpecification - - public.filename-extension - qoi - - - +