optional "desktop" feature

feat/vaults
Tomáš Mládek 2021-12-19 20:09:44 +01:00
parent 4ce227b82d
commit ac1e110b02
2 changed files with 13 additions and 5 deletions

View File

@ -48,10 +48,15 @@ walkdir = "2"
tree_magic = "0.2.3"
dotenv = "0.15.0"
webbrowser = "0.5.5"
xdg = "^2.1"
webbrowser = { version = "^0.5.5", optional = true }
nonempty = "0.6.0"
[dev-dependencies]
tempdir = "0.3.7"
[features]
default = ["desktop"]
desktop = ["webbrowser"]

View File

@ -152,10 +152,13 @@ fn main() -> Result<()> {
actix::spawn(filesystem::rescan_vault(db_pool, vault_path, job_container));
}
if !matches.is_present("NO_BROWSER") && ui_enabled {
let ui_result = webbrowser::open(&format!("http://localhost:{}", bind.port()));
if ui_result.is_err() {
warn!("Could not open UI in browser!");
#[cfg(feature = "desktop")]
{
if !matches.is_present("NO_BROWSER") && ui_enabled {
let ui_result = webbrowser::open(&format!("http://localhost:{}", bind.port()));
if ui_result.is_err() {
warn!("Could not open UI in browser!");
}
}
}