Skip to content

macos: Fall back to allowedFileTypes for save filters on 10.15 - #371

Open
vdavid wants to merge 1 commit into
PolyMeilex:masterfrom
vdavid:macos-10.15-save-filters
Open

vdavid wants to merge 1 commit into
PolyMeilex:masterfrom
vdavid:macos-10.15-save-filters

Conversation

@vdavid

@vdavid vdavid commented Dec 4, 2026

Copy link
Copy Markdown

My context: I use rfd in my file manager Cmdr, via tauri-plugin-dialog. Thanks for your work!

Problem: Since #328 (0.18.0), a save dialog with filters panics on macOS 10.15, with:

class UTType could not be found

What I've worked out is that UTType and NSSavePanel.allowedContentTypes are macOS 11+, and rfd doesn't state a macOS minimum. 0.17 worked fine on 10.15 Catalina (it used allowedFileTypes everywhere), so I think this counts as a regression. Open dialogs still use allowedFileTypes, so only the save panel is affected.

My solution: With the PR, set_allowed_types checks available!(macos = 11.0), and on 11+, it sets allowedContentTypes exactly as before, while on 10.15 it sets the extensions through allowedFileTypes. The format picker's options keep their Filter and go through the same function. For arm64 (or any deployment target of 11+), available! is a constant true, so nothing changes there.

One caveat: objc2-uniform-type-identifiers links UniformTypeIdentifiers.framework hard, and dyld refuses to start an app that loads a missing framework. So an app targeting 10.15 also has to weak-link it (-C link-arg=-Wl,-weak_framework,UniformTypeIdentifiers). That's the consumer's call to do, so I've only mentioned it in the changelog.

I've tested it on a real 10.15.8 Mac (Intel) with a tiny binary that opens a save dialog with two filters, weak-linked as above: 0.18.0 panics, this branch shows the dialog. Open dialogs with filters work on both. So looks like this is a win. cargo build, test, clippy, and fmt --check pass on macOS (aarch64 and x86_64).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant