Closed
Description
What You Are Seeing?
Trying to run CleanDirectory()
on a folder that has had some readonly
files copied into it using CopyFiles()
The issue is that CleanDirectory()
fails with access denied on the read only files.
What is Expected?
CleanDirectory()
deletes the files even if they are readonly
.
What version of Cake are you using?
0.16.2
Are you running on a 32 or 64 bit system?
x64
What environment are you running on? Windows? Linux? Mac?
Windows
Are you running on a CI Server? If so, which one?
N\A
How Did You Get This To Happen? (Steps to Reproduce)
Add some readonly
xsd files to ./Documents/Schemas/
and run the following cake file twice...
Task("Default")
.Does(() =>
{
var schemaFolder = Argument("schemaFolder", "./artifacts/schemas");
EnsureDirectoryExists(schemaFolder);
CleanDirectory(schemaFolder);
var files = GetFiles("./Documents/Schemas/*.xsd");
CopyFiles(files, schemaFolder);
});
RunTarget("Default");
Output Log
First Run
Preparing to run build script...
Running build script...
Analyzing build script...
Processing build script...
Compiling build script...
========================================
Default
========================================
Executing task: Default
Creating directory C:/Source/Main/artifacts/schemas
Cleaning directory C:/Source/Main/artifacts/schemas
Copying file main.xsd to C:/Source/Main/artifacts/schemas/main.xsd
Copying file sub.xsd to C:/Source/Main/artifacts/schemas/sub.xsd
Finished executing task: Default
Task Duration
--------------------------------------------------
Default 00:00:00.1268127
--------------------------------------------------
Total: 00:00:00.1268127
Second Run
Preparing to run build script...
Running build script...
Analyzing build script...
Processing build script...
Compiling build script...
========================================
Default
========================================
Executing task: Default
Cleaning directory C:/Source/Main/artifacts/schemas
An Error occured when executing task 'default'.
Error: Access to the path 'C:/Source/Main/artifacts/schemas/main.xsd' is denied.