From b51aea98b4ec5cf544c5820fb4e29bfe434e25f5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 30 May 2013 09:23:14 -0700 Subject: [PATCH] Copy symlinks properly --- Gruntfile.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 3560f6376..7c07d7e3b 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -13,8 +13,14 @@ module.exports = (grunt) -> if grunt.file.isDir(source) grunt.file.recurse source, (sourcePath, rootDirectory, subDirectory='', filename) -> return if filter?.test(sourcePath) + destinationPath = path.join(destination, subDirectory, filename) - grunt.file.copy(sourcePath, destinationPath) + if grunt.file.isLink(sourcePath) + grunt.file.mkdir(path.dirname(destinationPath)) + fs.symlinkSync(fs.readlinkSync(sourcePath), destinationPath) + else + grunt.file.copy(sourcePath, destinationPath) + if grunt.file.exists(destinationPath) fs.chmodSync(destinationPath, fs.statSync(sourcePath).mode) else