From 80ce347a8520c08b3dff6cbb10d77db8b402f3a3 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Wed, 21 Sep 2022 17:34:42 +0200 Subject: [PATCH] #90 fixed file paths what a nasty, nasty bug :| --- src/search-history.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/search-history.ts b/src/search-history.ts index b910968..4a0b5e5 100644 --- a/src/search-history.ts +++ b/src/search-history.ts @@ -1,13 +1,11 @@ -import { searchIndexFilePath } from './globals' +import { historyFilePath } from './globals' export let searchHistory: string[] = [] export async function loadSearchHistory(): Promise { - if (await app.vault.adapter.exists(searchIndexFilePath)) { + if (await app.vault.adapter.exists(historyFilePath)) { try { - searchHistory = JSON.parse( - await app.vault.adapter.read(searchIndexFilePath) - ) + searchHistory = JSON.parse(await app.vault.adapter.read(historyFilePath)) // Keep the last 100 searches searchHistory = searchHistory.slice(0, 100) } catch (e) { @@ -21,8 +19,5 @@ export async function loadSearchHistory(): Promise { } export async function saveSearchHistory(): Promise { - await app.vault.adapter.write( - searchIndexFilePath, - JSON.stringify(searchHistory) - ) + await app.vault.adapter.write(historyFilePath, JSON.stringify(searchHistory)) }