matrix-art

An image gallery for Matrix
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art.git
Log | Files | Refs | README | LICENSE

commit c1257aaadee14a74fb6954f1ced7549da67a3210
parent 0916be7580577e28c466c9f5e01a98adb276e059
Author: MTRNord <mtrnord1@gmail.com>
Date:   Fri, 14 Jan 2022 01:52:33 +0100

Make sure racing the folder creation will not break the build

Diffstat:
Mhelpers/storage.ts | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/helpers/storage.ts b/helpers/storage.ts @@ -7,11 +7,13 @@ export default class Storage { var LocalStorage = require('node-localstorage').LocalStorage; // eslint-disable-line unicorn/prefer-module var path = require('node:path'); // eslint-disable-line unicorn/prefer-module var fs = require('node:fs'); // eslint-disable-line unicorn/prefer-module - const dir = "localstorage"; + const dir = path.join(process.cwd(), "localstorage"); if (!fs.existsSync(dir)) { - fs.mkdirSync(dir); + try { + fs.mkdirSync(dir); + } catch { console.log("race while folder was checked"); } } - this.nodeLocalStorage = new LocalStorage(path.join(process.cwd(), dir)); + this.nodeLocalStorage = new LocalStorage(dir); } } getItem(key: string): any {