diff --git a/src/cli/version.rs b/src/cli/version.rs index 52ba510..fdd2f83 100644 --- a/src/cli/version.rs +++ b/src/cli/version.rs @@ -206,7 +206,24 @@ pub fn max_installed_version() -> anyhow::Result { .context("failed to read versions directory")? .collect::, _>>()? .into_iter() - .map(|entry| Version::parse(entry.path().file_stem().unwrap().to_str().unwrap()).unwrap()) + .map(|entry| { + #[cfg(not(windows))] + let name = entry + .path() + .file_name() + .unwrap() + .to_string_lossy() + .to_string(); + #[cfg(windows)] + let name = entry + .path() + .file_stem() + .unwrap() + .to_string_lossy() + .to_string(); + + Version::parse(&name).unwrap() + }) .max() .filter(|v| v >= ¤t_version()) .unwrap_or_else(current_version);