fix: detecting windows11 (#1170)
This commit is contained in:
parent
14311dde0a
commit
2813f1d654
|
|
@ -9,7 +9,22 @@ export const isMacOS = platform === "darwin"
|
|||
export const isWindows = platform === "win32"
|
||||
|
||||
export const isLinux = platform === "linux"
|
||||
export const isWindows11 = isWindows && os.version().startsWith("Windows 11")
|
||||
|
||||
/**
|
||||
* @see https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information
|
||||
* Windows 11 buildNumber starts from 22000.
|
||||
*/
|
||||
const detectingWindows11 = () => {
|
||||
if (!isWindows) return false
|
||||
|
||||
const release = os.release()
|
||||
const majorVersion = Number.parseInt(release.split(".")[0])
|
||||
const buildNumber = Number.parseInt(release.split(".")[2])
|
||||
|
||||
return majorVersion === 10 && buildNumber >= 22000
|
||||
}
|
||||
|
||||
export const isWindows11 = detectingWindows11()
|
||||
|
||||
// Custom APIs for renderer
|
||||
const api = {
|
||||
|
|
|
|||
|
|
@ -11,4 +11,19 @@ export const isMacOS = platform === "darwin"
|
|||
export const isWindows = platform === "win32"
|
||||
|
||||
export const isLinux = platform === "linux"
|
||||
export const isWindows11 = isWindows && os.version().startsWith("Windows 11")
|
||||
|
||||
/**
|
||||
* @see https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information
|
||||
* Windows 11 buildNumber starts from 22000.
|
||||
*/
|
||||
const detectingWindows11 = () => {
|
||||
if (!isWindows) return false
|
||||
|
||||
const release = os.release()
|
||||
const majorVersion = Number.parseInt(release.split(".")[0])
|
||||
const buildNumber = Number.parseInt(release.split(".")[2])
|
||||
|
||||
return majorVersion === 10 && buildNumber >= 22000
|
||||
}
|
||||
|
||||
export const isWindows11 = detectingWindows11()
|
||||
|
|
|
|||
Loading…
Reference in New Issue