Skip to content

Commit 538d88d

Browse files
bzozcodebytere
authored andcommitted
fix: write file to the current folder (nodejs#434)
1 parent d94d743 commit 538d88d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exports.appendFile = function(file, content) {
1414

1515
exports.writeFile = function(file, content) {
1616
const parts = path.parse(file);
17-
if (!fs.existsSync(parts.dir)) {
17+
if (parts.dir !== '' && !fs.existsSync(parts.dir)) {
1818
fs.mkdirSync(parts.dir, { recursive: true });
1919
}
2020
// TODO(joyeecheung): what if the file is a dir?

0 commit comments

Comments
 (0)