From 58d85371efb72a618edbbd531b3c55b4f44510e7 Mon Sep 17 00:00:00 2001 From: Jurgis Sakalauskas Date: Fri, 9 Dec 2022 18:13:11 +0200 Subject: [PATCH] fix recent searches path --- src/KodiApi/RecentSearches/recent-searches.service.ts | 8 ++++++-- src/config/config.service.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/KodiApi/RecentSearches/recent-searches.service.ts b/src/KodiApi/RecentSearches/recent-searches.service.ts index 6bd0e56..0b729ff 100644 --- a/src/KodiApi/RecentSearches/recent-searches.service.ts +++ b/src/KodiApi/RecentSearches/recent-searches.service.ts @@ -35,15 +35,19 @@ export class RecentSearchesService { } data.push(term); const rawData = JSON.stringify(data); - const filePath = join(this.configService.getRecentSearchesFolder(), module); + const filePath = this.getFilePath(module); await writeFile(filePath, rawData); } private async getRecentSearchesData(module: string): Promise> { - const filePath = join(this.configService.getRecentSearchesFolder(), module); + const filePath = this.getFilePath(module); const rawData = '' + (await readFile(filePath).catch(() => '[]')); return JSON.parse(rawData); } + + private getFilePath(module: string): string { + return join(this.configService.getRecentSearchesFolder(), module + '.json'); + } } diff --git a/src/config/config.service.ts b/src/config/config.service.ts index 301a498..4f69b66 100644 --- a/src/config/config.service.ts +++ b/src/config/config.service.ts @@ -33,7 +33,7 @@ export class ConfigService { } public getRecentSearchesFolder(): string { - return join(this.getRootPath(), this.getEnv('STATIC_SERVE_FOLDER')); + return join(this.getRootPath(), this.getEnv('RECENT_SEARCHES_FOLDER')); } private getRootPath(): string {