Changeset 1663


Ignore:
Timestamp:
1/25/2010 3:05:50 AM (5 years ago)
Author:
lowjoel
Message:

Backport from Trunk: Fixed regression in r1102: the check on Exists ensures that the DirectoryNotFoundException? will not be raised -- however, it doesn't guard against UnauthorizedAccessException?, so we should be guarding against that instead.

Location:
branches/eraser6/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0

  • branches/eraser6/6.0/Eraser.Manager/Task.cs

    r1374 r1663  
    672672            if (info.Exists) 
    673673            { 
    674                 foreach (DirectoryInfo dir in info.GetDirectories()) 
    675                     try 
    676                     { 
     674                try 
     675                { 
     676                    foreach (DirectoryInfo dir in info.GetDirectories()) 
    677677                        result.AddRange(GetFiles(dir)); 
    678                     } 
    679                     catch (DirectoryNotFoundException e) 
    680                     { 
    681                         //Ignore, but log. 
    682                         Task.Log.LastSessionEntries.Add(new LogEntry(S._("Could not erase {0} because {1}", 
    683                             dir.FullName, e.Message), LogLevel.Error)); 
    684                     } 
    685  
    686                 if (IncludeMask.Length == 0) 
    687                     result.AddRange(info.GetFiles()); 
    688                 else 
    689                     result.AddRange(info.GetFiles(IncludeMask, SearchOption.TopDirectoryOnly)); 
     678 
     679                    if (IncludeMask.Length == 0) 
     680                        result.AddRange(info.GetFiles()); 
     681                    else 
     682                        result.AddRange(info.GetFiles(IncludeMask, SearchOption.TopDirectoryOnly)); 
     683                } 
     684                catch (UnauthorizedAccessException e) 
     685                { 
     686                    Task.Log.LastSessionEntries.Add(new LogEntry(S._("Could not erase files and " + 
     687                        "subfolders in {0} because {1}", info.FullName, e.Message), LogLevel.Error)); 
     688                } 
    690689            } 
    691690 
Note: See TracChangeset for help on using the changeset viewer.