Remove cachePathExists property (Issue #800)

Remove cachePathsExist property to ensure missing cache directories are recreated when EnsureCachePaths() called.
This commit is contained in:
mcdinner 2022-07-03 16:35:12 +02:00
parent 2e466bb164
commit ebb2c5f791

View File

@ -10,13 +10,9 @@ class CacheManager {
this.CachePath = Path.join(global.MetadataPath, 'cache') this.CachePath = Path.join(global.MetadataPath, 'cache')
this.CoverCachePath = Path.join(this.CachePath, 'covers') this.CoverCachePath = Path.join(this.CachePath, 'covers')
this.ImageCachePath = Path.join(this.CachePath, 'images') this.ImageCachePath = Path.join(this.CachePath, 'images')
this.cachePathsExist = false
} }
async ensureCachePaths() { // Creates cache paths if necessary and sets owner and permissions async ensureCachePaths() { // Creates cache paths if necessary and sets owner and permissions
if (this.cachePathsExist) return
var pathsCreated = false var pathsCreated = false
if (!(await fs.pathExists(this.CachePath))) { if (!(await fs.pathExists(this.CachePath))) {
await fs.mkdir(this.CachePath) await fs.mkdir(this.CachePath)
@ -36,8 +32,6 @@ class CacheManager {
if (pathsCreated) { if (pathsCreated) {
await filePerms.setDefault(this.CachePath) await filePerms.setDefault(this.CachePath)
} }
this.cachePathsExist = true
} }
async handleCoverCache(res, libraryItem, options = {}) { async handleCoverCache(res, libraryItem, options = {}) {