cake-contrib / cake-contrib/Cake.FileHelpers
Add "Remove ReadOnly-Attribute" method
- Dominant language
- C#
- Stars
- 24
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
I raise this issue as a result of a gitter discussion.
My scenario: I have a couple of .config files checked in the source control (TFS VC), which needs to be replaced (or re-generated) before I invoke MSBuild.
I use "DeleteFiles" and/or "CleanDirectories" for this kind of stuff from Cake, but both will fail because they refuse to delete "read-only" protected files.
Gary told me that this behavior is by design and is in most cases the logical choice. He pointed me to the FileHelper addin - maybe this would be a good place for this kind of functionality.
My current workaround is trivial:
```
public void EnsureFileIsWritable(string filePath)
{
System.IO.File.SetAttributes(filePath, FileAttributes.Normal);
}
```
If you are interested in a PR just let me know.
Contributor guide
Assessment
This issue has not been assessed yet.