Skip to content

Commit 8d902ad

Browse files
Update src/compiler/sys.ts
Co-Authored-By: Nathan Shively-Sanders <[email protected]>
1 parent 8cf8eb1 commit 8d902ad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/compiler/sys.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,12 @@ namespace ts {
10331033

10341034
function fsWatch(fileOrDirectory: string, entryKind: FileSystemEntryKind.File | FileSystemEntryKind.Directory, callback: FsWatchCallback, recursive: boolean, fallbackPollingWatchFile: HostWatchFile, pollingInterval?: number): FileWatcher {
10351035
let options: any;
1036-
const lastDirectoryPartWithDirectorySeparator = isLinuxOrMacOs ?
1036+
let lastDirectoryPartWithDirectorySeparator: string | undefined;
1037+
let lastDirectoryPart: string | undefined;
1038+
if (isLinuxOrMacOs) {
1039+
lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(directorySeparator));
1040+
lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(directorySeparator.length);
1041+
}
10371042
fileOrDirectory.substr(fileOrDirectory.lastIndexOf(directorySeparator)) :
10381043
undefined;
10391044
const lastDirectoryPart = isLinuxOrMacOs ?

0 commit comments

Comments
 (0)