Problem
In pyenvUtils.ts, the calculation of versionsPath and envsPaths is incorrect on Windows due to the pyenv-win directory structure.
Current Code
// pyenvUtils.ts L128-130
const versionsPath = normalizePath(path.join(path.dirname(path.dirname(pyenv)), 'versions'));
const envsPaths = normalizePath(path.join(path.dirname(versionsPath), 'envs'));
Issue
On Windows, pyenv is located at ~/.pyenv/pyenv-win/bin/pyenv.bat. The current logic calculates:
path.dirname(path.dirname(pyenv)) → ~/.pyenv/pyenv-win ❌
- Should be
~/.pyenv to find versions folder properly
This causes:
- Environment grouping (
PYENV_VERSIONS vs PYENV_ENVIRONMENTS) to fail
- Environments not being associated with the correct manager
PET Server Reference
The PET server handles this correctly with platform-specific code in pet-pyenv/src/environment_locations.rs:
#[cfg(windows)]
pub fn get_home_pyenv_dir(env_vars: &EnvVariables) -> Option<PathBuf> {
let home = env_vars.home.clone()?;
Some(norm_case(home.join(".pyenv").join("pyenv-win")))
}
Suggested Fix
Add Windows-specific handling when calculating the versions and envs paths:
const pyenvDir = isWindows()
? path.dirname(path.dirname(path.dirname(pyenv))) // Go up 3 levels on Windows
: path.dirname(path.dirname(pyenv));
const versionsPath = normalizePath(path.join(pyenvDir, 'versions'));
Affected File
src/managers/pyenv/pyenvUtils.ts
Problem
In
pyenvUtils.ts, the calculation ofversionsPathandenvsPathsis incorrect on Windows due to the pyenv-win directory structure.Current Code
Issue
On Windows, pyenv is located at
~/.pyenv/pyenv-win/bin/pyenv.bat. The current logic calculates:path.dirname(path.dirname(pyenv))→~/.pyenv/pyenv-win❌~/.pyenvto findversionsfolder properlyThis causes:
PYENV_VERSIONSvsPYENV_ENVIRONMENTS) to failPET Server Reference
The PET server handles this correctly with platform-specific code in
pet-pyenv/src/environment_locations.rs:Suggested Fix
Add Windows-specific handling when calculating the versions and envs paths:
Affected File
src/managers/pyenv/pyenvUtils.ts