Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed copy symlink to directory on windows #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions lib/ncp.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ncp (source, dest, options, callback) {
limit = (limit < 1) ? 1 : (limit > 512) ? 512 : limit;

startCopy(currentPath);

function startCopy(source) {
started++;
if (filter) {
Expand Down Expand Up @@ -113,10 +113,10 @@ function ncp (source, dest, options, callback) {
function copyFile(file, target) {
var readStream = fs.createReadStream(file.name),
writeStream = fs.createWriteStream(target, { mode: file.mode });

readStream.on('error', onError);
writeStream.on('error', onError);

if(transform) {
transform(readStream, writeStream, file);
} else {
Expand Down Expand Up @@ -208,14 +208,17 @@ function ncp (source, dest, options, callback) {
});
});
}

function makeLink(linkPath, target) {
fs.symlink(linkPath, target, function (err) {
if (err) {
return onError(err);
}
return cb();
});
fs.stat(linkPath, function(err, stat) {
if (err)
return onError(err)
fs.symlink(linkPath, target, stat.isFile() ? 'file' : 'dir', function (err) {
if (err) {
return onError(err);
}
return cb();
});
})
}

function isWritable(path, done) {
Expand All @@ -241,7 +244,7 @@ function ncp (source, dest, options, callback) {
if (typeof errs.write === 'undefined') {
errs.push(err);
}
else {
else {
errs.write(err.stack + '\n\n');
}
return cb();
Expand All @@ -256,6 +259,4 @@ function ncp (source, dest, options, callback) {
}
}
}
}


}