summaryrefslogtreecommitdiff
path: root/std/path
diff options
context:
space:
mode:
Diffstat (limited to 'std/path')
-rw-r--r--std/path/_constants.ts14
-rw-r--r--std/path/glob.ts4
-rw-r--r--std/path/mod.ts2
-rw-r--r--std/path/separator.ts2
4 files changed, 4 insertions, 18 deletions
diff --git a/std/path/_constants.ts b/std/path/_constants.ts
index d26334b55..78755529b 100644
--- a/std/path/_constants.ts
+++ b/std/path/_constants.ts
@@ -46,17 +46,3 @@ export const CHAR_EQUAL = 61; /* = */
// Digits
export const CHAR_0 = 48; /* 0 */
export const CHAR_9 = 57; /* 9 */
-
-let NATIVE_OS: typeof Deno.build.os = "linux";
-// deno-lint-ignore no-explicit-any
-const navigator = (globalThis as any).navigator;
-if (globalThis.Deno != null) {
- 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 { NATIVE_OS };
diff --git a/std/path/glob.ts b/std/path/glob.ts
index fde2fe8e2..a9cd70143 100644
--- a/std/path/glob.ts
+++ b/std/path/glob.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
-import { NATIVE_OS } from "./_constants.ts";
+import { osType } from "../_util/os.ts";
import { join, normalize } from "./mod.ts";
import { SEP, SEP_PATTERN } from "./separator.ts";
@@ -80,7 +80,7 @@ const rangeEscapeChars = ["-", "\\", "]"];
* the group occurs not nested at the end of the segment. */
export function globToRegExp(
glob: string,
- { extended = true, globstar: globstarOption = true, os = NATIVE_OS }:
+ { extended = true, globstar: globstarOption = true, os = osType }:
GlobToRegExpOptions = {},
): RegExp {
if (glob == "") {
diff --git a/std/path/mod.ts b/std/path/mod.ts
index 58c2c4561..8819bf25f 100644
--- a/std/path/mod.ts
+++ b/std/path/mod.ts
@@ -2,7 +2,7 @@
// Ported mostly from https://github.com/browserify/path-browserify/
/** This module is browser compatible. */
-import { isWindows } from "./_constants.ts";
+import { isWindows } from "../_util/os.ts";
import * as _win32 from "./win32.ts";
import * as _posix from "./posix.ts";
diff --git a/std/path/separator.ts b/std/path/separator.ts
index 4b54ad438..61bb7c588 100644
--- a/std/path/separator.ts
+++ b/std/path/separator.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/** This module is browser compatible. */
-import { isWindows } from "./_constants.ts";
+import { isWindows } from "../_util/os.ts";
export const SEP = isWindows ? "\\" : "/";
export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;