Skip to content

Commit

Permalink
fix: copyFileToDir should be async (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Jul 4, 2023
1 parent e294af9 commit 68cf1d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathRef> {
const destinationPath = ensurePathRef(destinationDirPath)
.join(this.basename());
return this.copyFileSync(destinationPath);
return this.copyFile(destinationPath);
}

/**
Expand Down

0 comments on commit 68cf1d0

Please sign in to comment.