Changeset 1637


Ignore:
Timestamp:
01/22/10 05:24:40 (5 years ago)
Author:
lowjoel
Message:

Fixed exception when the filesystem object being erased is non-existent (i.e. when a task for erasing a removable drive was created, drive was removed and task executed)

  • StreamInfo? will have the Exists property return false if the directory containing the stream is not found either (this was an oversight)
  • VolumeInfo? will not throw a COMException when the the path is not a reparse point and if the provided mountpoint is non-existent.
Location:
branches/eraser6/6.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser.Manager/DirectExecutor.cs

    r1441 r1637  
    726726                task.OnProgressChanged(progress.Event); 
    727727                 
    728                 //Get the filesystem provider to handle the secure file erasures 
     728                //Check that the file exists - we do not want to bother erasing nonexistant files 
    729729                StreamInfo info = new StreamInfo(paths[i]); 
    730                 FileSystem fsManager = FileSystemManager.Get( 
    731                     VolumeInfo.FromMountpoint(info.DirectoryName)); 
    732  
    733                 //Check that the file exists - we do not want to bother erasing nonexistant files 
    734730                if (!info.Exists) 
    735731                { 
     
    738734                    continue; 
    739735                } 
     736 
     737                //Get the filesystem provider to handle the secure file erasures 
     738                FileSystem fsManager = FileSystemManager.Get( 
     739                    VolumeInfo.FromMountpoint(info.DirectoryName)); 
    740740 
    741741                bool isReadOnly = false; 
  • branches/eraser6/6.0/Eraser.Util/StreamInfo.cs

    r1360 r1637  
    134134                    if (!handle.IsInvalid) 
    135135                        return true; 
    136                     else if (Marshal.GetLastWin32Error() == 2 /*ERROR_FILE_NOT_FOUND*/) 
     136                    else if (Marshal.GetLastWin32Error() == 2 /*ERROR_FILE_NOT_FOUND*/ || 
     137                        Marshal.GetLastWin32Error() == 3 /*ERROR_PATH_NOT_FOUND*/) 
    137138                        return false; 
    138139 
  • branches/eraser6/6.0/Eraser.Util/VolumeInfo.cs

    r1360 r1637  
    178178            StringBuilder volumeID = new StringBuilder(50 * sizeof(char)); 
    179179 
     180            //Verify that the mountpoint given exists; if it doesn't we'll raise 
     181            //a PathNotFound exception. 
     182            if (!mountpointDir.Exists) 
     183                throw new DirectoryNotFoundException(); 
     184 
    180185            do 
    181186            { 
Note: See TracChangeset for help on using the changeset viewer.