You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #454 - zed-industries:nsopenpanel, r=jdm
Add bindings for NSOpenPanel
This PR adds bindings for the main `NSOpenPanel` APIs, which let you present a modal for selecting files or directories. Usage:
```rust
let panel = NSOpenPanel::openPanel(nil);
panel.setCanChooseDirectories_(YES);
panel.setCanChooseFiles_(NO);
panel.setAllowsMultipleSelection_(YES);
let response = panel.runModal();
if response == NSModalResponse::NSModalResponseOk {
let urls = panel.URLs();
for i in 0..urls.count() {
let url_ptr = urls.objectAtIndex(i).absoluteString().UTF8String();
let url = CStr::from_ptr(url_ptr).to_string_lossy();
eprintln!("You picked URL {}", url);
}
}
```
0 commit comments