From 59747973f681cca4dc4eb60d617638b0c194c137 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Sat, 6 Jun 2020 18:28:41 +0200 Subject: [PATCH] fix: write file to the current folder (#434) --- lib/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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?