Merge pull request #7676 from zhengbli/fixNodeOnSharePoint
Explicitly exclude . and .. for fs.readdirSync
This commit is contained in:
commit
6cc1b174fb
1 changed files with 5 additions and 0 deletions
|
@ -498,6 +498,11 @@ namespace ts {
|
||||||
const files = _fs.readdirSync(path || ".").sort();
|
const files = _fs.readdirSync(path || ".").sort();
|
||||||
const directories: string[] = [];
|
const directories: string[] = [];
|
||||||
for (const current of files) {
|
for (const current of files) {
|
||||||
|
// This is necessary because on some file system node fails to exclude
|
||||||
|
// "." and "..". See https://github.com/nodejs/node/issues/4002
|
||||||
|
if (current === "." || current === "..") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const name = combinePaths(path, current);
|
const name = combinePaths(path, current);
|
||||||
if (!contains(exclude, getCanonicalPath(name))) {
|
if (!contains(exclude, getCanonicalPath(name))) {
|
||||||
const stat = _fs.statSync(name);
|
const stat = _fs.statSync(name);
|
||||||
|
|
Loading…
Reference in a new issue