Move filedialog code into cfg-ed out folder

This commit is contained in:
Jonathan Kelley committed 2023-07-19 13:52:27 -07:00
1 parent 27a6babbd7
commit b1a4ac48d4
1 file changed
+27 -24
+27 -24
View File
@@ -14,7 +14,33 @@ pub(crate) struct FileDialogRequest {
pub bubbles: bool, pub bubbles: bool,
} }
fn get_file_event_for_folder(request: &FileDialogRequest, dialog: rfd::FileDialog) -> Vec<PathBuf> { #[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)))]
pub(crate) fn get_file_event(_request: &FileDialogRequest) -> Vec<PathBuf> {
vec![]
}
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
pub(crate) fn get_file_event(request: &FileDialogRequest) -> Vec<PathBuf> {
fn get_file_event_for_folder(
request: &FileDialogRequest,
dialog: rfd::FileDialog,
) -> Vec<PathBuf> {
if request.multiple { if request.multiple {
dialog.pick_folders().into_iter().flatten().collect() dialog.pick_folders().into_iter().flatten().collect()
} else { } else {
@@ -50,29 +76,6 @@ fn get_file_event_for_file(
files files
} }
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)))]
pub(crate) fn get_file_event(_request: &FileDialogRequest) -> Vec<PathBuf> {
vec![]
}
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
pub(crate) fn get_file_event(request: &FileDialogRequest) -> Vec<PathBuf> {
let dialog = rfd::FileDialog::new(); let dialog = rfd::FileDialog::new();
if request.directory { if request.directory {