diff options
Diffstat (limited to 'std/path/_constants.ts')
-rw-r--r-- | std/path/_constants.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/std/path/_constants.ts b/std/path/_constants.ts index 186c32ab5..920979432 100644 --- a/std/path/_constants.ts +++ b/std/path/_constants.ts @@ -47,14 +47,16 @@ export const CHAR_EQUAL = 61; /* = */ export const CHAR_0 = 48; /* 0 */ export const CHAR_9 = 57; /* 9 */ +let NATIVE_OS: typeof Deno.build.os = "linux"; // eslint-disable-next-line @typescript-eslint/no-explicit-any const navigator = (globalThis as any).navigator; - -let isWindows = false; if (globalThis.Deno != null) { - isWindows = Deno.build.os == "windows"; -} else if (navigator?.appVersion != null) { - isWindows = navigator.appVersion.includes("Win"); + NATIVE_OS = Deno.build.os; +} else if (navigator?.appVersion?.includes?.("Win") ?? false) { + NATIVE_OS = "windows"; } +// TODO(nayeemrmn): Improve OS detection in browsers beyond Windows. + +export const isWindows = NATIVE_OS == "windows"; -export { isWindows }; +export { NATIVE_OS }; |