move get_version_number to hbb_common
This commit is contained in:
parent
51f4f736bc
commit
dbdff120bc
@ -179,6 +179,14 @@ where
|
|||||||
Ok(io::BufReader::new(file).lines())
|
Ok(io::BufReader::new(file).lines())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_version_number(v: &str) -> i64 {
|
||||||
|
let mut n = 0;
|
||||||
|
for x in v.split(".") {
|
||||||
|
n = n * 1000 + x.parse::<i64>().unwrap_or(0);
|
||||||
|
}
|
||||||
|
n
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -369,8 +369,8 @@ impl UI {
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
let installed_version = crate::platform::windows::get_installed_version();
|
let installed_version = crate::platform::windows::get_installed_version();
|
||||||
let a = crate::common::get_version_number(crate::VERSION);
|
let a = hbb_common::get_version_number(crate::VERSION);
|
||||||
let b = crate::common::get_version_number(&installed_version);
|
let b = hbb_common::get_version_number(&installed_version);
|
||||||
return a > b;
|
return a > b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user