Skip to content

Commit

Permalink
Ensure the path contains the Ozy bin directory when running anything …
Browse files Browse the repository at this point in the history
…through Ozy (#55)
  • Loading branch information
yeetfield authored Feb 10, 2023
1 parent d3f79a8 commit 8c1320d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rozy/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::{anyhow, Context, Error, Result};
use file_lock::{FileLock, FileOptions};

use crate::config::{apply_overrides, load_config, resolve};
use crate::files::{delete_if_exists, get_ozy_cache_dir};
use crate::files::{check_path, delete_if_exists, get_ozy_bin_dir, get_ozy_cache_dir};
use crate::installers::conda::Conda;
use crate::installers::file::File;
use crate::installers::installer::Installer;
Expand Down Expand Up @@ -139,6 +139,12 @@ impl App {
return Ok(());
}

let ozy_bin_dir = get_ozy_bin_dir()?;
if !check_path(&ozy_bin_dir)? {
let updated_path = format!("{}:{}", ozy_bin_dir.display(), std::env::var("PATH")?);
std::env::set_var("PATH", updated_path);
}

let install_dir = self.get_install_path()?;
std::fs::create_dir_all(install_dir.parent().unwrap())
.context("While creating parent directory of install directory")?;
Expand Down

0 comments on commit 8c1320d

Please sign in to comment.