public void TearDown() { if (File.Exists(_widgetFile.Path)) { File.Delete(_widgetFile.Path); } if (Directory.Exists(_secondActivityFolder)) { RobustIO.DeleteDirectoryAndContents(_secondActivityFolder); } }
// See comment on class above regarding Dispose public void Dispose() { if (_detached) { return; } try { RobustFile.Delete(Path); } catch (IOException e) { // We tried, but we don't want to crash just because virus scanner or similar won't release the file. Debug.Fail("Could not delete temp file during Dispose(): " + e.Message, e.ToString()); } if (_folderToDelete != null) { RobustIO.DeleteDirectoryAndContents(_folderToDelete); } }
public static bool DeleteDirectoryRobust(string path, bool overrideReadOnly = true) { return(RobustIO.DeleteDirectoryAndContents(path, overrideReadOnly)); }