public virtual void CopyOutput() { if (OutputFiles == null) { return; } if (!BuildsOnCurrentPlatform) { return; } foreach (var fileCopy in OutputFiles) { FilePath targetFileName; var targetDir = fileCopy.ToDirectory ?? OutputDirectory; CakeContext.CreateDirectory(targetDir); if (fileCopy.NewFileName != null) { targetFileName = targetDir.CombineWithFilePath(fileCopy.NewFileName); } else { targetFileName = targetDir.CombineWithFilePath(fileCopy.FromFile.GetFilename()); } var srcAbs = CakeContext.MakeAbsolute(fileCopy.FromFile); var destAbs = CakeContext.MakeAbsolute(targetFileName); var sourceTime = System.IO.File.GetLastAccessTime(srcAbs.ToString()); var destTime = System.IO.File.GetLastAccessTime(destAbs.ToString()); CakeContext.Information("Target Dir: Exists? {0}, {1}", CakeContext.DirectoryExists(targetDir), targetDir); CakeContext.Information("Copy From: Exists? {0}, Dir Exists? {1}, Modified: {2}, {3}", CakeContext.FileExists(srcAbs), CakeContext.DirectoryExists(srcAbs.GetDirectory()), sourceTime, srcAbs); CakeContext.Information("Copy To: Exists? {0}, Dir Exists? {1}, Modified: {2}, {3}", CakeContext.FileExists(destAbs), CakeContext.DirectoryExists(destAbs.GetDirectory()), destTime, destAbs); if (sourceTime > destTime || !CakeContext.FileExists(destAbs)) { CakeContext.Information("Copying File: {0} to {1}", srcAbs, targetDir); CakeContext.CopyFileToDirectory(srcAbs, targetDir); } } }