mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-12 21:56:26 +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 () => {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
return await root.removeEntry(cobaltProcessingDir, { recursive: true });
|
||||
if (navigator.storage.getDirectory) {
|
||||
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