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 e564acb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crates/fj-viewer/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
//!
//! <https://github.com/gfx-rs/wgpu/issues/1492>
use std::{env::current_dir, path::PathBuf};
use std::path::PathBuf;

#[cfg(not(target_arch = "wasm32"))]
use std::env::current_dir;

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 +353,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 e564acb

Please sign in to comment.