@@ -63,7 +63,7 @@ namespace ts {
6363 }
6464
6565 function getCachedFileSystemEntries ( rootDirPath : Path ) : MutableFileSystemEntries | undefined {
66- return cachedReadDirectoryResult . get ( rootDirPath ) ;
66+ return cachedReadDirectoryResult . get ( ensureTrailingDirectorySeparator ( rootDirPath ) ) ;
6767 }
6868
6969 function getCachedFileSystemEntriesForBaseDir ( path : Path ) : MutableFileSystemEntries | undefined {
@@ -80,7 +80,7 @@ namespace ts {
8080 directories : host . getDirectories ( rootDir ) || [ ]
8181 } ;
8282
83- cachedReadDirectoryResult . set ( rootDirPath , resultFromHost ) ;
83+ cachedReadDirectoryResult . set ( ensureTrailingDirectorySeparator ( rootDirPath ) , resultFromHost ) ;
8484 return resultFromHost ;
8585 }
8686
@@ -90,6 +90,7 @@ namespace ts {
9090 * The host request is done under try catch block to avoid caching incorrect result
9191 */
9292 function tryReadDirectory ( rootDir : string , rootDirPath : Path ) : MutableFileSystemEntries | undefined {
93+ rootDirPath = ensureTrailingDirectorySeparator ( rootDirPath ) ;
9394 const cachedResult = getCachedFileSystemEntries ( rootDirPath ) ;
9495 if ( cachedResult ) {
9596 return cachedResult ;
@@ -100,7 +101,7 @@ namespace ts {
100101 }
101102 catch ( _e ) {
102103 // If there is exception to read directories, dont cache the result and direct the calls to host
103- Debug . assert ( ! cachedReadDirectoryResult . has ( rootDirPath ) ) ;
104+ Debug . assert ( ! cachedReadDirectoryResult . has ( ensureTrailingDirectorySeparator ( rootDirPath ) ) ) ;
104105 return undefined ;
105106 }
106107 }
@@ -142,7 +143,7 @@ namespace ts {
142143
143144 function directoryExists ( dirPath : string ) : boolean {
144145 const path = toPath ( dirPath ) ;
145- return cachedReadDirectoryResult . has ( path ) || host . directoryExists ( dirPath ) ;
146+ return cachedReadDirectoryResult . has ( ensureTrailingDirectorySeparator ( path ) ) || host . directoryExists ( dirPath ) ;
146147 }
147148
148149 function createDirectory ( dirPath : string ) {
0 commit comments