Skip to content

Commit

Permalink
Merge pull request #7676 from zhengbli/fixNodeOnSharePoint
Browse files Browse the repository at this point in the history
Explicitly exclude . and .. for fs.readdirSync
  • Loading branch information
zhengbli committed Mar 24, 2016
2 parents 55cbdc9 + ddbfb7b commit 6cc1b17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ namespace ts {
const files = _fs.readdirSync(path || ".").sort();
const directories: string[] = [];
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);
if (!contains(exclude, getCanonicalPath(name))) {
const stat = _fs.statSync(name);
Expand Down

0 comments on commit 6cc1b17

Please sign in to comment.