Set cwd of setup/update during start

This commit is contained in:
Caelan Sayler
2024-01-25 10:46:48 +00:00
parent d936617bc9
commit 839f816c76
2 changed files with 10 additions and 0 deletions

View File

@@ -43,6 +43,11 @@ fn main() -> Result<()> {
info!(" Debug: {:?}", debug);
}
// change working directory to the containing directory of the exe
let mut containing_dir = env::current_exe()?;
containing_dir.pop();
env::set_current_dir(containing_dir)?;
let res = commands::install(debug, installto);
if let Err(e) = &res {
error!("An error has occurred: {}", e);

View File

@@ -90,6 +90,11 @@ fn main() -> Result<()> {
info!(" Silent: {}", silent);
info!(" Log File: {:?}", log_file);
// change working directory to the containing directory of the exe
let mut containing_dir = env::current_exe()?;
containing_dir.pop();
env::set_current_dir(containing_dir)?;
let (subcommand, subcommand_matches) = matches.subcommand().ok_or_else(|| anyhow!("No subcommand was used. Try `--help` for more information."))?;
let result = match subcommand {
#[cfg(target_os = "windows")]