move get_version_number to hbb_common

This commit is contained in:
rustdesk
2021-12-27 00:24:57 +08:00
parent 51f4f736bc
commit dbdff120bc
2 changed files with 10 additions and 2 deletions

View File

@@ -179,6 +179,14 @@ where
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)]
mod tests {
use super::*;