Context
docs/examples/ui/dialogs/snippets.ts declares // platforms: macos, linux, windows and imports openFolderDialog from perry/ui to demonstrate the folder-picker pattern. The example compiles + links cleanly on macOS but fails on the GTK4-on-Ubuntu doc-tests CI runner with:
/usr/bin/ld: perry_llvm_*.ll:(.text+...): undefined reference to `perry_ui_open_folder_dialog'
Origin/main is currently red on the gtk4 doc-tests gate because of this and two layout FFIs (filed separately).
What's missing
| FFI |
macOS |
GTK4 |
perry_ui_open_folder_dialog |
✅ wired (NSOpenPanel with canChooseDirectories: YES, canChooseFiles: NO) |
❌ missing |
Recommended GTK4 implementation
gtk::FileChooserDialog with Action::SelectFolder is the direct mapping. Mirror the existing GTK4 file-picker pattern (search crates/perry-ui-gtk4/src/ for FileChooserNative / FileChooserDialog) — fold this in by changing the action to SelectFolder and removing the file-filter setup. The TS callback signature is (path: string) => void; on cancel pass an empty string to match the macOS implementation's contract.
Acceptance
Pointers
- macOS implementation: search
crates/perry-ui-macos/src/ for perry_ui_open_folder_dialog.
- GTK4 file-picker reference (closest existing analogue): search
crates/perry-ui-gtk4/src/ for whatever already wires openFileDialog / saveFileDialog. Add the SelectFolder variant alongside.
- Failing doc-test:
docs/examples/ui/dialogs/snippets.ts (banner declares all 3 platforms; line invokes openFolderDialog).
Related
Estimated size
Small — ~30-50 LOC including the GTK4 FFI wrapper, the FFI export in lib.rs, and possibly an entry in the styling matrix.
Context
docs/examples/ui/dialogs/snippets.tsdeclares// platforms: macos, linux, windowsand importsopenFolderDialogfromperry/uito demonstrate the folder-picker pattern. The example compiles + links cleanly on macOS but fails on the GTK4-on-Ubuntu doc-tests CI runner with:Origin/main is currently red on the gtk4 doc-tests gate because of this and two layout FFIs (filed separately).
What's missing
perry_ui_open_folder_dialogNSOpenPanelwithcanChooseDirectories: YES, canChooseFiles: NO)Recommended GTK4 implementation
gtk::FileChooserDialogwithAction::SelectFolderis the direct mapping. Mirror the existing GTK4 file-picker pattern (searchcrates/perry-ui-gtk4/src/forFileChooserNative/FileChooserDialog) — fold this in by changing the action toSelectFolderand removing the file-filter setup. The TS callback signature is(path: string) => void; on cancel pass an empty string to match the macOS implementation's contract.Acceptance
perry_ui_open_folder_dialogexported as#[no_mangle] pub extern "C" fnincrates/perry-ui-gtk4/src/lib.rs.MissingtoWired.cargo build --release -p perry-ui-gtk4succeeds.docs/examples/ui/dialogs/snippets.tscompiles + links cleanly on Linux. Verify by inspecting the linker output (the example's runtime test mode exits before opening any modal, soPERRY_UI_TEST_MODE=1is sufficient).Pointers
crates/perry-ui-macos/src/forperry_ui_open_folder_dialog.crates/perry-ui-gtk4/src/for whatever already wiresopenFileDialog/saveFileDialog. Add theSelectFoldervariant alongside.docs/examples/ui/dialogs/snippets.ts(banner declares all 3 platforms; line invokesopenFolderDialog).Related
styleattribute in HTML. #185 (UI cross-platform audit)Estimated size
Small — ~30-50 LOC including the GTK4 FFI wrapper, the FFI export in lib.rs, and possibly an entry in the styling matrix.