https://bugzilla.novell.com/show_bug.cgi?id=378229
User [EMAIL PROTECTED] added comment https://bugzilla.novell.com/show_bug.cgi?id=378229#c2 --- Comment #2 from Eric Albright <[EMAIL PROTECTED]> 2008-04-16 01:53:57 MST --- "Unlike the Read-only attribute for a file, the Read-only attribute for a folder is typically ignored by Windows, Windows components and accessories, and other programs. For example, you can delete, rename, and change a folder with the Read-only attribute by using Windows Explorer." http://support.microsoft.com/kb/326549/EN-US/ I am able to set the read-only attribute on a directory and then delete a file in the directory. Deleting a directory which contains a read-only file is not. [TestFixture] public class FileAndDirectoryDelete { string file; private string directory; [SetUp] public void Setup() { directory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Directory.CreateDirectory(directory); file = Path.Combine(directory, Path.GetRandomFileName()); using(StreamWriter stream = File.CreateText(this.file)) { stream.Close(); } } [TearDown] public void TearDown() { if (File.Exists(file)) { File.SetAttributes(file, FileAttributes.Normal); } if (Directory.Exists(directory)) { File.SetAttributes(directory, FileAttributes.Normal); Directory.Delete(directory, true); } } [Test] [ExpectedException(typeof(UnauthorizedAccessException))] public void DirectoryDelete_FileIsReadOnly_Throws() { File.SetAttributes(file, FileAttributes.ReadOnly); Directory.Delete(directory, true); } [Test] public void FileDelete_DirectoryIsReadOnly_FileDeleted() { File.SetAttributes(directory, FileAttributes.ReadOnly); File.Delete(file); Assert.IsFalse(File.Exists(file)); } } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
