Skip to content

Commit

Permalink
fix: write file to the current folder (nodejs#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzoz authored Jun 6, 2020
1 parent c6697de commit 5974797
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/file.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ exports.appendFile = function(file, content) {

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

0 comments on commit 5974797

Please sign in to comment.