fix: 无法删除部分文件夹(Meloong-Git/PCL#8878,@Peacock-Que)

This commit is contained in:
龙腾猫跃 committed 2026-07-03 14:15:10 +08:00
1 parent c16ef849e6
commit cf42cf19e3
2 files changed
+13 -1

No files matched your search

+12
View File
@@ -75,6 +75,18 @@ public class DirectoryUtilsTest : TestWithFolder {
public void 剪切_安全检查()
=> Assert.Throws<UnauthorizedAccessException>(() => DirectoryUtils.Move(Paths.Base, Path.Combine(tempFolder, "SafetyCheckDest")));
[Test]
public async Task 删除_安全检查_允许程序目录下的子文件夹() {
var folder = Path.Combine(Paths.Base, $"MeloongTest_{Guid.NewGuid():N}");
try {
DirectoryUtils.Create(folder);
DirectoryUtils.Delete(folder);
await Assert.That(DirectoryUtils.Exists(folder)).IsFalse();
} finally {
if (Directory.Exists(PathUtils.ForApi(folder))) Directory.Delete(PathUtils.ForApi(folder), true);
}
}
#endregion
}