mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: parse versions on non windows platforms correctly
This commit is contained in:
parent
f732451252
commit
00db2a51c2
1 changed files with 18 additions and 1 deletions
|
@ -206,7 +206,24 @@ pub fn max_installed_version() -> anyhow::Result<Version> {
|
||||||
.context("failed to read versions directory")?
|
.context("failed to read versions directory")?
|
||||||
.collect::<Result<Vec<_>, _>>()?
|
.collect::<Result<Vec<_>, _>>()?
|
||||||
.into_iter()
|
.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()
|
.max()
|
||||||
.filter(|v| v >= ¤t_version())
|
.filter(|v| v >= ¤t_version())
|
||||||
.unwrap_or_else(current_version);
|
.unwrap_or_else(current_version);
|
||||||
|
|
Loading…
Reference in a new issue