From 2c9f20607014e2c01464f4af783c778d923f642c Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 6 Jul 2018 17:50:25 -0400 Subject: [PATCH 1/2] Remove realpathCache argument in fs.realpath The cache was removed in Node 6 in favor of a faster native implementation. We're on Node 8 now. --- lib/directory.js | 5 ++--- lib/file.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/directory.js b/lib/directory.js index b353bae9..98c7a7ce 100644 --- a/lib/directory.js +++ b/lib/directory.js @@ -5,7 +5,6 @@ const fs = require('fs-plus') const PathWatcher = require('pathwatcher') const File = require('./file') const {repoForPath} = require('./helpers') -const realpathCache = {} module.exports = class Directory { @@ -116,7 +115,7 @@ class Directory { this.lowerCaseRealPath = this.realPath.toLowerCase() } } else { - fs.realpath(this.path, realpathCache, (error, realPath) => { + fs.realpath(this.path, {}, (error, realPath) => { // FIXME: Add actual error handling if (error || this.destroyed) return if (realPath && (realPath !== this.path)) { @@ -320,7 +319,7 @@ class Directory { // track the insertion index for the created views files.push(name) } else { - files.push(new File({name, fullPath, symlink, realpathCache, ignoredNames: this.ignoredNames, useSyncFS: this.useSyncFS, stats: statFlat})) + files.push(new File({name, fullPath, symlink, ignoredNames: this.ignoredNames, useSyncFS: this.useSyncFS, stats: statFlat})) } } } diff --git a/lib/file.js b/lib/file.js index 089ec4e6..080f862f 100644 --- a/lib/file.js +++ b/lib/file.js @@ -4,7 +4,7 @@ const {repoForPath} = require('./helpers') module.exports = class File { - constructor ({name, fullPath, symlink, realpathCache, ignoredNames, useSyncFS, stats}) { + constructor ({name, fullPath, symlink, ignoredNames, useSyncFS, stats}) { this.name = name this.symlink = symlink this.ignoredNames = ignoredNames @@ -22,7 +22,7 @@ class File { if (useSyncFS) { this.realPath = fs.realpathSync(this.path) } else { - fs.realpath(this.path, realpathCache, (error, realPath) => { + fs.realpath(this.path, {}, (error, realPath) => { // FIXME: Add actual error handling if (error || this.destroyed) return if (realPath && realPath !== this.path) { From f4be1fc0e77ba549191736026027af0ef0e685eb Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 6 Jul 2018 17:58:04 -0400 Subject: [PATCH 2/2] :art: --- lib/directory.js | 2 +- lib/file.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/directory.js b/lib/directory.js index 98c7a7ce..e1462492 100644 --- a/lib/directory.js +++ b/lib/directory.js @@ -115,7 +115,7 @@ class Directory { this.lowerCaseRealPath = this.realPath.toLowerCase() } } else { - fs.realpath(this.path, {}, (error, realPath) => { + fs.realpath(this.path, (error, realPath) => { // FIXME: Add actual error handling if (error || this.destroyed) return if (realPath && (realPath !== this.path)) { diff --git a/lib/file.js b/lib/file.js index 080f862f..8c26f2e8 100644 --- a/lib/file.js +++ b/lib/file.js @@ -22,7 +22,7 @@ class File { if (useSyncFS) { this.realPath = fs.realpathSync(this.path) } else { - fs.realpath(this.path, {}, (error, realPath) => { + fs.realpath(this.path, (error, realPath) => { // FIXME: Add actual error handling if (error || this.destroyed) return if (realPath && realPath !== this.path) {