Skip to content

Commit

Permalink
Fix build on wasm32
Browse files Browse the repository at this point in the history
  • Loading branch information
erenoku committed Oct 29, 2022
1 parent 8b1c6fc commit d208d2c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/fj-viewer/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use std::{env::current_dir, path::PathBuf};

use crossbeam_channel::{Receiver, Sender};

#[cfg(not(target_arch = "wasm32"))]
use rfd::FileDialog;

use fj_interop::status_report::StatusReport;
Expand Down Expand Up @@ -348,9 +350,13 @@ impl Gui {
}

fn show_file_dialog() -> Option<PathBuf> {
FileDialog::new()
#[cfg(not(target_arch = "wasm32"))]
return FileDialog::new()
.set_directory(current_dir().unwrap_or_else(|_| PathBuf::from("/")))
.pick_folder()
.pick_folder();

#[cfg(target_arch = "wasm32")]
todo!("Picking folders does not work on wasm32")
}

impl std::fmt::Debug for Gui {
Expand Down

0 comments on commit d208d2c

Please sign in to comment.