cake-contrib / cake-contrib/Cake.FileHelpers

Add "Remove ReadOnly-Attribute" method

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.