Ignore:
Timestamp:
3/6/2010 8:32:07 AM (2 years ago)
Author:
lowjoel
Message:

Forward port from Eraser 6.0: Potential fix for the "Insufficient disk space" error when deleting files securely. My hypothesis is that invalidly-named files cause the file system to allocate file entries differently (we rename the same file with a name of the same length to eliminate reallocation of MFT entries) so this patch will fix that, ensuring filenames are always valid.

Location:
trunk/eraser6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6

  • trunk/eraser6/Eraser.Manager/FileSystem.cs

    r1862 r1884  
    6767                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ _+=-()[]{}',`~!"; 
    6868                for (int j = 0, k = resultAry.Length; j < k; ++j) 
     69                { 
    6970                    resultAry[j] = (byte)validFileNameChars[ 
    7071                        (int)resultAry[j] % validFileNameChars.Length]; 
     72 
     73                    if (j == 0 || j == k - 1) 
     74                        //The first or last character cannot be whitespace 
     75                        while (Char.IsWhiteSpace((char)resultAry[j])) 
     76                            resultAry[j] = (byte)validFileNameChars[ 
     77                                (int)resultAry[j] % validFileNameChars.Length]; 
     78                } 
    7179 
    7280                result = Encoding.UTF8.GetString(resultAry); 
Note: See TracChangeset for help on using the changeset viewer.