summaryrefslogtreecommitdiff
path: root/std/path/posix.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/path/posix.ts')
-rw-r--r--std/path/posix.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/std/path/posix.ts b/std/path/posix.ts
index e88eb3f97..365232e33 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -1,8 +1,8 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
+/** This module is browser compatible. */
-const { cwd } = Deno;
-import { FormatInputPathObject, ParsedPath } from "./interface.ts";
+import { FormatInputPathObject, ParsedPath } from "./_interface.ts";
import { CHAR_DOT, CHAR_FORWARD_SLASH } from "./_constants.ts";
import {
@@ -24,7 +24,12 @@ export function resolve(...pathSegments: string[]): string {
let path: string;
if (i >= 0) path = pathSegments[i];
- else path = cwd();
+ else {
+ if (globalThis.Deno == null) {
+ throw new TypeError("Resolved a relative path without a CWD.");
+ }
+ path = Deno.cwd();
+ }
assertPath(path);