fix: detect original path before unlinking

This commit is contained in:
Wesley F. Young 2024-10-14 08:48:43 +08:00
parent ac47b4903c
commit 3070614f40

View File

@ -92,8 +92,9 @@ export class LaanaFileUtils {
if (stat.isFile()) {
await fsPromises.unlink(cachePath);
} else if (stat.isSymbolicLink()) {
const originalPath = await fsPromises.readlink(cachePath);
await fsPromises.unlink(cachePath);
await fsPromises.unlink(await fsPromises.readlink(cachePath));
await fsPromises.unlink(originalPath);
} else {
throw Error('不支持的缓存类型');
}