summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_fs/_fs_rename.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/_fs/_fs_rename.ts')
-rw-r--r--ext/node/polyfills/_fs/_fs_rename.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/node/polyfills/_fs/_fs_rename.ts b/ext/node/polyfills/_fs/_fs_rename.ts
index 5d87619c7..ff0a7246b 100644
--- a/ext/node/polyfills/_fs/_fs_rename.ts
+++ b/ext/node/polyfills/_fs/_fs_rename.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-import { fromFileUrl } from "ext:deno_node/path.ts";
+import { pathFromURL } from "ext:deno_web/00_infra.js";
import { promisify } from "ext:deno_node/internal/util.mjs";
export function rename(
@@ -7,8 +7,8 @@ export function rename(
newPath: string | URL,
callback: (err?: Error) => void,
) {
- oldPath = oldPath instanceof URL ? fromFileUrl(oldPath) : oldPath;
- newPath = newPath instanceof URL ? fromFileUrl(newPath) : newPath;
+ oldPath = oldPath instanceof URL ? pathFromURL(oldPath) : oldPath;
+ newPath = newPath instanceof URL ? pathFromURL(newPath) : newPath;
if (!callback) throw new Error("No callback function supplied");
@@ -21,8 +21,8 @@ export const renamePromise = promisify(rename) as (
) => Promise<void>;
export function renameSync(oldPath: string | URL, newPath: string | URL) {
- oldPath = oldPath instanceof URL ? fromFileUrl(oldPath) : oldPath;
- newPath = newPath instanceof URL ? fromFileUrl(newPath) : newPath;
+ oldPath = oldPath instanceof URL ? pathFromURL(oldPath) : oldPath;
+ newPath = newPath instanceof URL ? pathFromURL(newPath) : newPath;
Deno.renameSync(oldPath, newPath);
}