Permalink
Browse files

Do copies recursively for packages.

  • Loading branch information...
1 parent 3b4b4f5 commit 4b3629c78f173decf844cbad9e4c5703540f3d17 @mde mde committed Nov 15, 2011
Showing with 13 additions and 12 deletions.
  1. +13 −12 lib/package_task.js
View
@@ -113,27 +113,28 @@ PackageTask.prototype = new (function () {
, fDirArr = fDir.split('/')
, baseDir = ''
, stats;
+
+ // Make any necessary container directories
fDirArr.forEach(function (dir) {
baseDir += baseDir ? '/' + dir : dir;
if (!path.existsSync(baseDir)) {
fs.mkdirSync(baseDir, 0755);
}
});
- stats = fs.statSync(name);
- if (stats.isDirectory()) {
- fs.mkdirSync(f, 0755);
- }
- else {
- fileList.push({
- to: name
- , from: f
- });
- }
+
+ // Add both files and directories, will be copied with -R
+ fileList.push({
+ to: name
+ , from: f
+ });
});
var _copyFile = function () {
- var file = fileList.pop();
+ var cmd
+ , file = fileList.pop();
if (file) {
- exec('cp ' + file.to + ' ' + file.from, function (err, stdout, stderr) {
+ // Do recursive copy of files and directories
+ cmd = 'cp -R ' + file.to + ' ' + file.from;
+ exec(cmd, function (err, stdout, stderr) {
if (err) { throw err; }
_copyFile();
});

0 comments on commit 4b3629c

Please sign in to comment.