Skip to content

Commit

Permalink
fixup: N/A -> Windows N/A
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Sep 4, 2023
1 parent 63bcf2e commit 4bebd70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions talpid-platform-metadata/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use windows_sys::Win32::System::{
#[allow(non_camel_case_types)]
type RTL_OSVERSIONINFOEXW = OSVERSIONINFOEXW;

const WINDOWS_UNKNOWN_STR: &str = "Windows N/A";
const BUILD_UNKNOWN_STR: &str = "N/A";

pub fn version() -> String {
let (major, build) = WindowsVersion::new()
.map(|version_info| {
Expand All @@ -21,15 +24,15 @@ pub fn version() -> String {
version_info.build_number().to_string(),
)
})
.unwrap_or_else(|_| ("N/A".to_string(), "N/A".to_string()));
.unwrap_or_else(|_| (WINDOWS_UNKNOWN_STR.to_owned(), BUILD_UNKNOWN_STR.to_owned()));

format!("{} Build {}", major, build)
}

pub fn short_version() -> String {
WindowsVersion::new()
.map(|version| version.windows_version_string())
.unwrap_or("Windows N/A".into())
.unwrap_or(WINDOWS_UNKNOWN_STR.to_owned())
}

pub fn extra_metadata() -> impl Iterator<Item = (String, String)> {
Expand Down

0 comments on commit 4bebd70

Please sign in to comment.