Changeset 893


Ignore:
Timestamp:
04/27/09 11:47:01 (6 years ago)
Author:
lowjoel
Message:

Don't allow file writes to stay in the system cache for later writing - instruct that data be written to disk immediately. Fixes #171.

File:
1 edited

Legend:

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

    r879 r893  
    620620 
    621621                    //Create the stream 
    622                     using (FileStream stream = new FileStream(currFile, 
    623                         FileMode.CreateNew, FileAccess.Write)) 
     622                    using (FileStream stream = new FileStream(currFile, FileMode.CreateNew, 
     623                        FileAccess.Write, FileShare.None, 8, FileOptions.WriteThrough)) 
    624624                    { 
    625625                        //Set the length of the file to be the amount of free space left 
     
    824824            //Create the stream, lengthen the file, then tell the erasure method 
    825825            //to erase the tips. 
    826             using (FileStream stream = streamInfo.Open(FileMode.Open, FileAccess.Write, FileShare.None)) 
     826            using (FileStream stream = streamInfo.Open(FileMode.Open, FileAccess.Write, 
     827                FileShare.None, FileOptions.WriteThrough)) 
    827828            { 
    828829                long fileLength = stream.Length; 
     
    895896                        using (FileStream strm = new FileStream(Path.Combine( 
    896897                            info.FullName, GenerateRandomFileName(18)), 
    897                             FileMode.CreateNew, FileAccess.Write)) 
     898                            FileMode.CreateNew, FileAccess.Write, FileShare.None, 8, 
     899                            FileOptions.WriteThrough)) 
    898900                        { 
    899901                            //Stretch the file size to use up some of the resident space. 
     
    10331035                { 
    10341036                    //Log the error 
     1037                    //TODO: This would leave files after the list unerased. Log this as an error instead 
    10351038                    throw new ArgumentException(S._("Compressed, encrypted, or sparse" + 
    10361039                        "files cannot be erased with Eraser.")); 
Note: See TracChangeset for help on using the changeset viewer.