diff --git a/lib/file.js b/lib/file.js index 01fb60f6..3213f4dd 100644 --- a/lib/file.js +++ b/lib/file.js @@ -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?