Просмотр исходного кода

fix: 删除文件夹没有长路径处理

龙腾猫跃 5 месяцев назад
Родитель
Сommit
a1a367a749
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      Shared/Utils/DirectoryUtils.cs

+ 2 - 1
Shared/Utils/DirectoryUtils.cs

@@ -101,9 +101,10 @@ public static class DirectoryUtils {
         if (toRecycleBin) {
             FileUtils.DeleteToRecycleBin(folder); // 删除到回收站
         } else {
-            DeleteInternal(PathUtils.WithLongPath(folder)); // 永久删除
+            DeleteInternal(folder); // 永久删除
             static void DeleteInternal(string folder) {
                 try {
+                    folder = PathUtils.WithLongPath(folder);
                     foreach (string filePath in DirectoryUtils.GetFiles(folder, true)) FileUtils.Delete(filePath); // 删除文件
                     foreach (string str in DirectoryUtils.GetDirectories(folder, true)) DeleteInternal(str); // 递归删除子文件夹
                     ResilientUtils.RetryOn<IOException>(() => Directory.Delete(folder, true)); // 最终删除文件夹