Skip to content

Commit 7ca90bc

Browse files
committed
Prefer windows vars on windows OS and more logging
1 parent 1abe5ce commit 7ca90bc

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

crates/pet-conda/src/conda_rc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ fn get_conda_conda_rc_from_path(conda_rc: &PathBuf) -> Option<Condarc> {
216216
if env_dirs.is_empty() && files.is_empty() {
217217
None
218218
} else {
219+
trace!("conda_rc: {:?} with env_dirs {:?}", conda_rc, env_dirs);
219220
Some(Condarc { env_dirs, files })
220221
}
221222
}

crates/pet-conda/src/environment_locations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ fn get_conda_environment_paths_from_conda_rc(env_vars: &EnvVariables) -> Vec<Pat
7575
let mut env_dirs = vec![];
7676
for rc_file_dir in get_conda_rc_search_paths(env_vars) {
7777
if !rc_file_dir.exists() {
78+
trace!(".condarc not found ({:?})", rc_file_dir);
7879
continue;
7980
}
8081

@@ -111,7 +112,7 @@ fn get_conda_environment_paths_from_conda_rc(env_vars: &EnvVariables) -> Vec<Pat
111112
);
112113
env_dirs.append(&mut conda_rc.env_dirs.clone());
113114
} else {
114-
trace!("No Conda environments in .condarc");
115+
trace!("No Conda environments in .condarc {:?}", env_dirs);
115116
}
116117
env_dirs
117118
}

crates/pet-core/src/os_environment.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,18 @@ impl Environment for EnvironmentApi {
133133
}
134134
}
135135

136+
#[cfg(windows)]
137+
fn get_user_home() -> Option<PathBuf> {
138+
let home = env::var("USERPROFILE").or_else(|_| env::var("HOME"));
139+
match home {
140+
Ok(home) => Some(norm_case(PathBuf::from(home))),
141+
Err(_) => None,
142+
}
143+
}
144+
145+
#[cfg(unix)]
136146
fn get_user_home() -> Option<PathBuf> {
137-
let home = env::var("HOME").or_else(|_| env::var("USERPROFILE"));
147+
let home = env::var("HOME");
138148
match home {
139149
Ok(home) => Some(norm_case(PathBuf::from(home))),
140150
Err(_) => None,

0 commit comments

Comments
 (0)