Skip to content

Commit

Permalink
Fix overridden log dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Jan 4, 2025
1 parent 7f11e8b commit 79740db
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ unsafe fn detach_console() {

fn main() {
let mut failed = false;
let args = cli::parse();

if let Some(config_dir) = args.as_ref().ok().and_then(|args| args.config.as_ref()) {
*CONFIG_DIR.lock().unwrap() = Some(config_dir.clone());
}

let logger = prepare_logging();
#[allow(clippy::useless_asref)]
Expand All @@ -163,7 +168,7 @@ fn main() {
log::debug!("Version: {}", *VERSION);
log::debug!("Invocation: {:?}", std::env::args());

let args = match cli::parse() {
let args = match args {
Ok(x) => x,
Err(e) => {
match e.kind() {
Expand All @@ -177,10 +182,6 @@ fn main() {
}
};

if let Some(config_dir) = args.config.as_deref() {
*CONFIG_DIR.lock().unwrap() = Some(config_dir.to_path_buf());
}

match args.sub {
None => {
// Do any extra CLI parsing before we detach the console.
Expand Down

0 comments on commit 79740db

Please sign in to comment.