diff --git a/Cargo.lock b/Cargo.lock index 5e72ebe..92357f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5194,7 +5194,7 @@ dependencies = [ [[package]] name = "xdg-desktop-portal-luminous" -version = "0.1.2" +version = "0.1.3" dependencies = [ "accessdialog", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index b46db41..3932a9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xdg-desktop-portal-luminous" -version = "0.1.2" +version = "0.1.3" edition = "2021" [workspace] diff --git a/src/main.rs b/src/main.rs index 4194cb3..320674a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -127,18 +127,26 @@ async fn main() -> anyhow::Result<()> { .build() .await?; - tokio::spawn(async move { - let Ok(home) = std::env::var("HOME") else { - return; - }; + if let Ok(home) = std::env::var("HOME") { let config_path = std::path::Path::new(home.as_str()) .join(".config") .join("xdg-desktop-portal-luminous"); - if let Err(e) = async_watch(config_path, conn).await { - tracing::info!("Maybe file is not exist, error: {e}"); + if config_path.exists() && config_path.is_dir() { + tokio::spawn(async move { + let Ok(home) = std::env::var("HOME") else { + return; + }; + let config_path = std::path::Path::new(home.as_str()) + .join(".config") + .join("xdg-desktop-portal-luminous"); + if let Err(e) = async_watch(config_path, conn).await { + tracing::info!("Maybe file is not exist, error: {e}"); + } + }); } - }); + }; pending::<()>().await; + Ok(()) }