Skip to content

Commit

Permalink
use IFileSystem instead of System.File.IO
Browse files Browse the repository at this point in the history
  • Loading branch information
martinscholz83 committed Aug 22, 2016
1 parent da15709 commit 8e0f02b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Cake.Common/IO/FileCopier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ private static void CopyFileCore(ICakeContext context, FilePath filePath, FilePa
var file = context.FileSystem.GetFile(absoluteFilePath);

// Get the parent folder structure and create it.
var newRelativeFolderPath = filePath.GetDirectory().ToString().Replace(commonPath.Replace("\\", "/"), string.Empty);
var newTargetPath = absoluteTargetPath.GetDirectory() + newRelativeFolderPath;
var newAbsoluteTargetPath = newTargetPath + @"/" + filePath.GetFilename();
var newRelativeFolderPath = context.Directory(commonPath).Path.GetRelativePath(filePath.GetDirectory());
var newTargetPath = targetFilePath.GetDirectory().Combine(newRelativeFolderPath);
var newAbsoluteTargetPath = newTargetPath.CombineWithFilePath(filePath.GetFilename());
context.Log.Verbose("Copying file {0} to {1}", absoluteFilePath.GetFilename(), newAbsoluteTargetPath);

if (!Directory.Exists(newTargetPath))
if (!context.DirectoryExists(newTargetPath))
{
Directory.CreateDirectory(newTargetPath);
context.CreateDirectory(newTargetPath);
}

file.Copy(newAbsoluteTargetPath, true);
Expand Down

0 comments on commit 8e0f02b

Please sign in to comment.