Close GH-795: Ignore file symlinks when reading project, fixes #791 and #783.. Fixes #791, Fixes #783

This commit is contained in:
Andre Cruz
2013-08-17 22:39:59 +01:00
parent 4402b80ec9
commit 72e6e61970
2 changed files with 9 additions and 3 deletions

View File

@@ -638,6 +638,11 @@ Project.prototype._readLinks = function () {
return;
}
// Skip links to files (see #783)
if (!valid.isDirectory()) {
return;
}
name = path.basename(dir);
return readJson(dir, {
assume: { name: name }

View File

@@ -2,16 +2,17 @@ var Q = require('q');
var fs = require('graceful-fs');
function validLink(file) {
// Filter only those that are valid links
// Ensures that a file is a symlink that points
// to a valid file
return Q.nfcall(fs.lstat, file)
.then(function (stat) {
if (!stat.isSymbolicLink()) {
return [false, null];
return [false];
}
return Q.nfcall(fs.stat, file)
.then(function () {
return [true, null];
return [stat];
});
})
.fail(function (err) {