kopia lustrzana https://github.com/c9/core
Do not use fs.exists and handle error instead
rodzic
1a397a4a72
commit
d74f1949b8
|
@ -186,18 +186,20 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var sourcePath = path.resolve(pathMap[prefix], path.relative(prefix, targetPath));
|
var sourcePath = path.resolve(pathMap[prefix], path.relative(prefix, targetPath));
|
||||||
|
|
||||||
if (!fs.existsSync(sourcePath))
|
try {
|
||||||
return;
|
var files = fs.readdirSync(sourcePath);
|
||||||
|
} catch (e) {
|
||||||
var files = fs
|
if (e.code === "ENOENT") return;
|
||||||
.readdirSync(sourcePath)
|
else throw e;
|
||||||
.filter(function(p) {
|
}
|
||||||
return !excludePattern.test(p)
|
|
||||||
&& !/[\s#]/.test(p)
|
|
||||||
&& /\.js$/.test(p);
|
|
||||||
});
|
|
||||||
|
|
||||||
files.map(function(p) {
|
files = files.filter(function(p) {
|
||||||
|
return !excludePattern.test(p)
|
||||||
|
&& !/[\s#]/.test(p)
|
||||||
|
&& /\.js$/.test(p);
|
||||||
|
});
|
||||||
|
|
||||||
|
files.forEach(function(p) {
|
||||||
result.push(targetPath + "/" + path.basename(p, ".js"));
|
result.push(targetPath + "/" + path.basename(p, ".js"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue