#90 fixed file paths

what a nasty, nasty bug :|
This commit is contained in:
Simon Cambier
2022-09-21 17:34:42 +02:00
parent 60de958d72
commit 80ce347a85

View File

@@ -1,13 +1,11 @@
import { searchIndexFilePath } from './globals' import { historyFilePath } from './globals'
export let searchHistory: string[] = [] export let searchHistory: string[] = []
export async function loadSearchHistory(): Promise<void> { export async function loadSearchHistory(): Promise<void> {
if (await app.vault.adapter.exists(searchIndexFilePath)) { if (await app.vault.adapter.exists(historyFilePath)) {
try { try {
searchHistory = JSON.parse( searchHistory = JSON.parse(await app.vault.adapter.read(historyFilePath))
await app.vault.adapter.read(searchIndexFilePath)
)
// Keep the last 100 searches // Keep the last 100 searches
searchHistory = searchHistory.slice(0, 100) searchHistory = searchHistory.slice(0, 100)
} catch (e) { } catch (e) {
@@ -21,8 +19,5 @@ export async function loadSearchHistory(): Promise<void> {
} }
export async function saveSearchHistory(): Promise<void> { export async function saveSearchHistory(): Promise<void> {
await app.vault.adapter.write( await app.vault.adapter.write(historyFilePath, JSON.stringify(searchHistory))
searchIndexFilePath,
JSON.stringify(searchHistory)
)
} }