From 340e09fe52dee8c611152856a137f381b4e36562 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 3 Jul 2023 20:48:07 -0400 Subject: [PATCH 1/2] fix: copyFileToDir should be async --- src/path.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/path.ts b/src/path.ts index ee4b33c..7f00ca9 100644 --- a/src/path.ts +++ b/src/path.ts @@ -825,10 +825,10 @@ export class PathRef { * Copies the file to the specified directory. * @returns The destination file path. */ - copyFileToDir(destinationDirPath: string | URL | PathRef): PathRef { + copyFileToDir(destinationDirPath: string | URL | PathRef): Promise { const destinationPath = ensurePathRef(destinationDirPath) .join(this.basename()); - return this.copyFileSync(destinationPath); + return this.copyFile(destinationPath); } /** From 300bbf4cd26741e0eea97bc912bf5cd3728b630f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 3 Jul 2023 20:49:09 -0400 Subject: [PATCH 2/2] Fix test --- src/path.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/path.test.ts b/src/path.test.ts index 48ec764..c80a634 100644 --- a/src/path.test.ts +++ b/src/path.test.ts @@ -688,7 +688,7 @@ Deno.test("copyFileToDir", async () => { assertEquals(dir.join("file.txt").toString(), newPath.toString()); assertEquals(newPath.readTextSync(), "text"); const dir2 = createPathRef("dir2").mkdirSync(); - const newPath2 = path.copyFileToDir(dir2); + const newPath2 = path.copyFileToDirSync(dir2); assert(newPath2.existsSync()); assertEquals(newPath2.readTextSync(), "text"); assertEquals(newPath2.toString(), dir2.join("file.txt").toString());