fix: actually await some more promises in the local provider

This commit is contained in:
Ashhhleyyy 2022-09-21 15:06:04 +01:00
parent c615b2e0c1
commit b45fc9a025
Signed by: ash
GPG key ID: 83B789081A0878FB

View file

@ -40,7 +40,7 @@ async function localJson<T>(comicId: string, path: string): Promise<T | null> {
if (parsed === null) return null;
const [providerKey, id] = parsed;
const pth = dataPath(`comics/${providerKey}/${id}/${path}`);
if (!pathExists(pth)) return null;
if (!await pathExists(pth)) return null;
return JSON.parse(await FileSystem.readAsStringAsync(pth));
}
@ -48,7 +48,7 @@ async function localJson<T>(comicId: string, path: string): Promise<T | null> {
const localProvider: LocalProvider = {
async listComics() {
const directory = dataPath('comics/');
if (!pathExists(directory)) return [];
if (!await pathExists(directory)) return [];
const providers = await FileSystem.readDirectoryAsync(directory) as NonLocalProviderKey[];
const comics: LocalComicMetadata[] = [];
for (const provider of providers) {