From 74f0f27d18571d41eb6988a2f1e72c19c22f4c73 Mon Sep 17 00:00:00 2001 From: Simon Sarris Date: Thu, 19 Jun 2014 18:25:00 -0400 Subject: [PATCH] Before copying file, explicitly remove the old one On Windows, FileUtils.cp(path, dest_path) will fail with a Permission Denied if the dest_path already exists and is read-only. People have complained about this since at least 2008. This lets `jekyll build` work without error in Windows when one or more read-only files exist. This change will accommodate users of Team Foundation, which uses the read-only flag for for source control status. (dumb, I know, but but a real problem) --- lib/jekyll/static_file.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index dfbc9fba..2382d03c 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -59,6 +59,7 @@ module Jekyll @@mtimes[path] = mtime FileUtils.mkdir_p(File.dirname(dest_path)) + FileUtils.rm(dest_path) if File.exist?(dest_path) FileUtils.cp(path, dest_path) true