Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle no model argument being passed #1286

Merged
merged 7 commits into from
Oct 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Comment on lines +361 to +362
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and the other cfgs) aren't great, but I can't think of a better way to do it right now. Maybe the file picking feature should move out of fj-viewer and into fj-window or fj-app? No idea. We'll figure it out at some point!

}

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