From 8feb05f8088ffb145cc0e2f04e2a04d342d43cda Mon Sep 17 00:00:00 2001 From: "Zachary P. Brasseaux" Date: Tue, 21 May 2019 12:05:41 -0500 Subject: [PATCH] Fix for ./dist/blog initialization issue (#48) When I went to create a blog for the first time, it kept throwing an error due to the fact that ./dist/blog did not exist. The recursive argument in the fs.mkdirSync function should have created it, but didn't. With this change, it now works on my system. --- blog.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blog.js b/blog.js index e3991ab..fd1ca81 100644 --- a/blog.js +++ b/blog.js @@ -14,6 +14,12 @@ program .parse(process.argv); function createBlog(title, subtitle, pagetitle, folder) { + // Checks to make sure this directory actually exists + // and creates it if it doesn't + if (!fs.existsSync(`./dist/blog/`)){ + fs.mkdirSync(`./dist/blog/`, { recursive: true }, err => {}); + } + if (!fs.existsSync(`./dist/blog/${folder}`)){ fs.mkdirSync(`./dist/blog/${folder}`, { recursive: true }); }