From 8d902ad75ff60df6792dddeea104d9e43d335f76 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 9 Aug 2019 13:57:47 -0700 Subject: [PATCH] Update src/compiler/sys.ts Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> --- src/compiler/sys.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 4418737ec96..45a67a8fee3 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1033,7 +1033,12 @@ namespace ts { function fsWatch(fileOrDirectory: string, entryKind: FileSystemEntryKind.File | FileSystemEntryKind.Directory, callback: FsWatchCallback, recursive: boolean, fallbackPollingWatchFile: HostWatchFile, pollingInterval?: number): FileWatcher { let options: any; - const lastDirectoryPartWithDirectorySeparator = isLinuxOrMacOs ? + let lastDirectoryPartWithDirectorySeparator: string | undefined; + let lastDirectoryPart: string | undefined; + if (isLinuxOrMacOs) { + lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(directorySeparator)); + lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(directorySeparator.length); + } fileOrDirectory.substr(fileOrDirectory.lastIndexOf(directorySeparator)) : undefined; const lastDirectoryPart = isLinuxOrMacOs ?