Skip to content

Commit

Permalink
src: cli: Remove unwraps while resolving the symlink case for current…
Browse files Browse the repository at this point in the history
… execution path
  • Loading branch information
joaoantoniocardoso committed Apr 28, 2023
1 parent c232a8b commit 59cdabc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/cli/manager.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use anyhow::Context;
use clap;
use std::sync::Arc;
use tracing::error;
Expand All @@ -14,11 +15,14 @@ lazy_static! {
static ref CURRENT_EXECUTION_WWW_PATH: String = format!(
"{}/www",
std::env::current_exe()
.unwrap()
.parent()
.unwrap()
.to_str()
.unwrap()
.and_then(std::fs::canonicalize)
.map_err(anyhow::Error::msg)
.and_then(|path| path
.to_owned()
.to_str()
.context("Failed to convert path to str")
.map(String::from))
.expect("Failed to get current executable path")
);
}

Expand Down

0 comments on commit 59cdabc

Please sign in to comment.