Changeset 1082


Ignore:
Timestamp:
6/1/2009 1:18:30 PM (5 years ago)
Author:
lowjoel
Message:

When erasing folders which don't exist, just ignore the error and continue since this is not an error (if you're deleting something that already is deleted then it's a success.)

Location:
trunk/eraser6/Eraser.Manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Eraser.Manager/DirectExecutor.cs

    r1068 r1082  
    907907                    //If the folder is a mount point, then don't delete it. If it isn't, 
    908908                    //search for files under the folder to see if it is empty. 
    909                     if (!isVolumeRoot && info.GetFiles("*", SearchOption.AllDirectories).Length == 0) 
     909                    if (!isVolumeRoot && info.Exists && info.GetFiles("*", SearchOption.AllDirectories).Length == 0) 
    910910                    { 
    911911                        FileSystem fsManager = FileSystem.Get(VolumeInfo.FromMountpoint(fldr.Path)); 
  • trunk/eraser6/Eraser.Manager/Task.cs

    r1056 r1082  
    600600        { 
    601601            List<FileInfo> result = new List<FileInfo>(); 
    602             foreach (DirectoryInfo dir in info.GetDirectories()) 
    603                 try 
    604                 { 
    605                     result.AddRange(GetFiles(dir)); 
    606                 } 
    607                 catch (Exception e) 
    608                 { 
    609                     //Ignore, but log. 
    610                     Task.Log.LastSessionEntries.Add(new LogEntry(S._("Could not erase {0} because {1}", 
    611                         dir.FullName, e.Message), LogLevel.Error)); 
    612                 } 
    613  
    614             if (includeMask.Length == 0) 
    615                 result.AddRange(info.GetFiles()); 
    616             else 
    617                 result.AddRange(info.GetFiles(includeMask, SearchOption.TopDirectoryOnly)); 
     602            if (info.Exists) 
     603            { 
     604                foreach (DirectoryInfo dir in info.GetDirectories()) 
     605                    try 
     606                    { 
     607                        result.AddRange(GetFiles(dir)); 
     608                    } 
     609                    catch (Exception e) 
     610                    { 
     611                        //Ignore, but log. 
     612                        Task.Log.LastSessionEntries.Add(new LogEntry(S._("Could not erase {0} because {1}", 
     613                            dir.FullName, e.Message), LogLevel.Error)); 
     614                    } 
     615 
     616                if (includeMask.Length == 0) 
     617                    result.AddRange(info.GetFiles()); 
     618                else 
     619                    result.AddRange(info.GetFiles(includeMask, SearchOption.TopDirectoryOnly)); 
     620            } 
     621 
    618622            return result.ToArray(); 
    619623        } 
Note: See TracChangeset for help on using the changeset viewer.