From 00088864674b463c522101874cb87b92cb3543c1 Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Fri, 19 Jan 2024 16:40:30 +0100 Subject: [PATCH] watch catalog file even if non existing, to be able to detect new file --- packages/backend/src/managers/catalogManager.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/managers/catalogManager.ts b/packages/backend/src/managers/catalogManager.ts index 565b3df1a..db1e390bd 100644 --- a/packages/backend/src/managers/catalogManager.ts +++ b/packages/backend/src/managers/catalogManager.ts @@ -59,9 +59,6 @@ export class CatalogManager { async loadCatalog() { const catalogPath = path.resolve(this.appUserDirectory, 'catalog.json'); - if (!existsSync(catalogPath)) { - return this.setCatalog(defaultCatalog); - } try { this.watchCatalogFile(catalogPath); // do not await, we want to do this async @@ -69,6 +66,10 @@ export class CatalogManager { console.error(`unable to watch catalog file, changes to the catalog file won't be reflected to the UI`, err); } + if (!existsSync(catalogPath)) { + return this.setCatalog(defaultCatalog); + } + try { const cat = await this.readAndAnalyzeCatalog(catalogPath); return this.setCatalog(cat);