mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-15 07:16:40 +01:00
web/storage: catch the missing dir error
This commit is contained in:
parent
61efa619a2
commit
19a342457b
1 changed files with 8 additions and 2 deletions
|
@ -54,7 +54,13 @@ export const removeFromFileStorage = async (filename: string) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clearFileStorage = async () => {
|
export const clearFileStorage = async () => {
|
||||||
const root = await navigator.storage.getDirectory();
|
if (navigator.storage.getDirectory) {
|
||||||
return await root.removeEntry(cobaltProcessingDir, { recursive: true });
|
const root = await navigator.storage.getDirectory();
|
||||||
|
try {
|
||||||
|
await root.removeEntry(cobaltProcessingDir, { recursive: true });
|
||||||
|
} catch {
|
||||||
|
// ignore the error because the dir might be missing and that's okay!
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue