Skip to content

Commit

Permalink
Merge pull request #246 from sid-6581/fix/winpath
Browse files Browse the repository at this point in the history
  • Loading branch information
MordechaiHadad authored Dec 17, 2024
2 parents 0b05a89 + 3aa2654 commit 93c82b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/handlers/use_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,11 @@ fn add_to_path(installation_dir: &Path) -> Result<()> {
let current_usr = RegKey::predef(HKEY_CURRENT_USER);
let env = current_usr.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE)?;
let usr_path: String = env.get_value("Path")?;
let usr_path_lower = usr_path.replace('/', "\\").to_lowercase();
let installation_dir = installation_dir.replace('/', "\\");
let installation_dir_lower = installation_dir.to_lowercase();

if usr_path.contains(installation_dir) {
if usr_path_lower.contains(&installation_dir_lower) {
return Ok(());
}

Expand Down
4 changes: 2 additions & 2 deletions src/helpers/directories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn get_home_dir() -> Result<PathBuf> {
pub fn get_local_data_dir() -> Result<PathBuf> {
let mut home_dir = get_home_dir()?;
if cfg!(windows) {
home_dir.push("AppData/Local");
home_dir.push("AppData\\Local");
return Ok(home_dir);
}

Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn get_config_file() -> Result<PathBuf> {
let mut home_dir = get_home_dir()?;

if cfg!(windows) {
home_dir.push("AppData/Roaming");
home_dir.push("AppData\\Roaming");
} else if cfg!(target_os = "macos") {
home_dir.push("Library/Application Support");
} else {
Expand Down

0 comments on commit 93c82b6

Please sign in to comment.