Skip to content

Commit

Permalink
revert dirExists
Browse files Browse the repository at this point in the history
  • Loading branch information
ptpaterson committed Nov 26, 2024
1 parent e41202d commit c30f346
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/file-util.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ export function fixPath(path) {
*/
export function dirExists(path) {
const fs = container.resolve("fs");
return fs.existsSync(fixPath(path));
const stat = fs.statSync(fixPath(path), {
// returns undefined instead of throwing if the file doesn't exist
throwIfNoEntry: false,
});
if (stat === undefined || !stat.isDirectory()) {
return false;
} else {
return true;
}
}

/**
Expand Down

0 comments on commit c30f346

Please sign in to comment.