up
This commit is contained in:
@@ -304,14 +304,29 @@ export class PackageStore {
|
||||
await this.exclusive(async () => {
|
||||
const dir = await this.path(key)
|
||||
await rm(dir, { recursive: true, force: true })
|
||||
this.ready.delete(key)
|
||||
this.descriptions.delete(key)
|
||||
for (const token of this.checked.keys())
|
||||
if (token.startsWith(`${key}/`)) this.checked.delete(token)
|
||||
for (const token of this.repaired)
|
||||
if (token.startsWith(`${key}/`)) this.repaired.delete(token)
|
||||
for (const token of this.assetErrors.keys())
|
||||
if (token.startsWith(`${key}/`)) this.assetErrors.delete(token)
|
||||
this.forget(key)
|
||||
})
|
||||
}
|
||||
private forget(key: string) {
|
||||
this.ready.delete(key)
|
||||
this.descriptions.delete(key)
|
||||
for (const token of this.checked.keys())
|
||||
if (token.startsWith(`${key}/`)) this.checked.delete(token)
|
||||
for (const token of this.repaired)
|
||||
if (token.startsWith(`${key}/`)) this.repaired.delete(token)
|
||||
for (const token of this.assetErrors.keys())
|
||||
if (token.startsWith(`${key}/`)) this.assetErrors.delete(token)
|
||||
}
|
||||
async clear(): Promise<void> {
|
||||
await this.exclusive(async () => {
|
||||
await Promise.allSettled([...this.loading.values(), ...this.remembering.values()])
|
||||
const root = await this.path()
|
||||
for (const key of await readdir(root)) {
|
||||
if (!hex.test(key)) continue
|
||||
// Удаляется сама ссылка, без перехода к её цели.
|
||||
await rm(join(root, key), { recursive: true, force: true })
|
||||
this.forget(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
private descriptionPackage(pkg: ScreenPackage): LocalPackage {
|
||||
|
||||
Reference in New Issue
Block a user