Make rfd optional
This commit is contained in:
parent
c6d9060872
commit
0f565caea1
2 changed files with 7 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ fontdb = "0.15.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = "0.4.20"
|
log = "0.4.20"
|
||||||
mime_guess = "2"
|
mime_guess = "2"
|
||||||
rfd = "0.12.0"
|
rfd = { version = "0.12.0", optional = true }
|
||||||
serde = { version = "1", features = ["serde_derive"] }
|
serde = { version = "1", features = ["serde_derive"] }
|
||||||
syntect = "5.1.0"
|
syntect = "5.1.0"
|
||||||
two-face = "0.3.0"
|
two-face = "0.3.0"
|
||||||
|
|
@ -33,6 +33,9 @@ default-features = false
|
||||||
features = ["winit", "wgpu"]
|
features = ["winit", "wgpu"]
|
||||||
#path = "../libcosmic"
|
#path = "../libcosmic"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["rfd"]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
smithay-client-toolkit = { git = "https://github.com/pop-os/client-toolkit", branch = "wayland-resize" }
|
smithay-client-toolkit = { git = "https://github.com/pop-os/client-toolkit", branch = "wayland-resize" }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -677,6 +677,7 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::OpenFileDialog => {
|
Message::OpenFileDialog => {
|
||||||
|
#[cfg(feature = "rfd")]
|
||||||
return Command::perform(
|
return Command::perform(
|
||||||
async {
|
async {
|
||||||
if let Some(handle) = rfd::AsyncFileDialog::new().pick_file().await {
|
if let Some(handle) = rfd::AsyncFileDialog::new().pick_file().await {
|
||||||
|
|
@ -693,6 +694,7 @@ impl Application for App {
|
||||||
return self.update_tab();
|
return self.update_tab();
|
||||||
}
|
}
|
||||||
Message::OpenProjectDialog => {
|
Message::OpenProjectDialog => {
|
||||||
|
#[cfg(feature = "rfd")]
|
||||||
return Command::perform(
|
return Command::perform(
|
||||||
async {
|
async {
|
||||||
if let Some(handle) = rfd::AsyncFileDialog::new().pick_folder().await {
|
if let Some(handle) = rfd::AsyncFileDialog::new().pick_folder().await {
|
||||||
|
|
@ -736,6 +738,7 @@ impl Application for App {
|
||||||
|
|
||||||
match self.active_tab_mut() {
|
match self.active_tab_mut() {
|
||||||
Some(tab) => {
|
Some(tab) => {
|
||||||
|
#[cfg(feature = "rfd")]
|
||||||
if tab.path_opt.is_none() {
|
if tab.path_opt.is_none() {
|
||||||
//TODO: use async file dialog
|
//TODO: use async file dialog
|
||||||
tab.path_opt = rfd::FileDialog::new().save_file();
|
tab.path_opt = rfd::FileDialog::new().save_file();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue