From 050aafbdda8d3d14c4cc0fd9869d5c62631f2156 Mon Sep 17 00:00:00 2001 From: Aaron Francis Date: Thu, 19 Aug 2021 18:00:07 -0500 Subject: [PATCH] Ensure cache --- package.json | 2 +- src/cache/file.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c7233e1..c84153e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@torchlight-api/torchlight-cli", - "version": "0.0.4", + "version": "0.0.5", "description": "A CLI for Torchlight - the syntax highlighting API", "main": "index.js", "scripts": { diff --git a/src/cache/file.js b/src/cache/file.js index 4a9f0fa..784d4f4 100644 --- a/src/cache/file.js +++ b/src/cache/file.js @@ -13,6 +13,10 @@ const { * @constructor */ let File = function (options = {}) { + if (!options.directory) { + throw new Error('No cache directory specified.'); + } + this.directory = path.resolve(options.directory) ensureDirSync(this.directory);