From ccdc3d60c444d0526d3b31d9e28d73536925ec91 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Mon, 19 Aug 2024 19:25:01 -0700 Subject: [PATCH] Change: CacheManager use ensureDir --- server/managers/CacheManager.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/server/managers/CacheManager.js b/server/managers/CacheManager.js index 24d43b67..8f810a33 100644 --- a/server/managers/CacheManager.js +++ b/server/managers/CacheManager.js @@ -23,21 +23,10 @@ class CacheManager { this.ImageCachePath = Path.join(this.CachePath, 'images') this.ItemCachePath = Path.join(this.CachePath, 'items') - if (!(await fs.pathExists(this.CachePath))) { - await fs.mkdir(this.CachePath) - } - - if (!(await fs.pathExists(this.CoverCachePath))) { - await fs.mkdir(this.CoverCachePath) - } - - if (!(await fs.pathExists(this.ImageCachePath))) { - await fs.mkdir(this.ImageCachePath) - } - - if (!(await fs.pathExists(this.ItemCachePath))) { - await fs.mkdir(this.ItemCachePath) - } + await fs.ensureDir(this.CachePath) + await fs.ensureDir(this.CoverCachePath) + await fs.ensureDir(this.ImageCachePath) + await fs.ensureDir(this.ItemCachePath) } async handleCoverCache(res, libraryItemId, coverPath, options = {}) {