From 17c8c32e9e5025b22bfe43626f8b84e40f2ad8f9 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 4 Jun 2020 09:53:40 +0200 Subject: [PATCH] fix: write file to the current folder --- 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?