The file will be overwritten anyway, so better just:
        File.SetAttributes(dstPath, 0);

;-)


Date: Thu, 25 Jul 2002 10:32:35 +0300
To: [EMAIL PROTECTED]
From: Adrian-Bogdan Andreias <[EMAIL PROTECTED]>
Subject: fix for bug [ 569102 ] File copy error...

Hi guys,

Here's a fix for the bug [ 569102 ]; to reproduce try to copy (overwrite) to a file with read-only attribute.
I checked with Ant, it ignores this attribute and so I did.

Insert code in file CopyTask.cs, method CopyTask.DoFileOperations, line 128, before File.Copy(sourcePath, dstPath, true); :

// code
FileAttributes fileAttributes = File.GetAttributes (dstPath);
fileAttributes &= ~FileAttributes.ReadOnly;
File.SetAttributes(dstPath, fileAttributes);
// end of code

Did not checked, but I assume that an exception is thrown if target file has System attribute.
I'll check it.
------------------------------------------------------- This sf.net email is sponsored by: Jabber - The world's fastest growing real-time communications platform! Don't just IM. Build it in! http://www.jabber.com/osdn/xim _______________________________________________ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to