File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -1037,21 +1037,7 @@ namespace Harness {
1037
1037
if ( path [ path . length - 1 ] === "/" ) {
1038
1038
path = < ts . Path > path . substr ( 0 , path . length - 1 ) ;
1039
1039
}
1040
-
1041
- let exists = false ;
1042
- fileMap . forEachValue ( fileName => {
1043
- if ( ! exists && pathStartsWithDirectory ( fileName , path ) ) {
1044
- exists = true ;
1045
- }
1046
- } ) ;
1047
- if ( ! exists && realPathMap ) {
1048
- realPathMap . forEachValue ( fileName => {
1049
- if ( ! exists && pathStartsWithDirectory ( fileName , path ) ) {
1050
- exists = true ;
1051
- }
1052
- } ) ;
1053
- }
1054
- return exists ;
1040
+ return mapHasFileInDirectory ( path , fileMap ) || mapHasFileInDirectory ( path , realPathMap ) ;
1055
1041
} ,
1056
1042
getDirectories : d => {
1057
1043
const path = ts . toPath ( d , currentDirectory , getCanonicalFileName ) ;
@@ -1072,8 +1058,17 @@ namespace Harness {
1072
1058
} ;
1073
1059
}
1074
1060
1075
- function pathStartsWithDirectory ( fileName : string , directory : string ) {
1076
- return ts . startsWith ( fileName , directory ) && fileName [ directory . length ] === "/" ;
1061
+ function mapHasFileInDirectory ( directoryPath : ts . Path , map : ts . FileMap < any > ) : boolean {
1062
+ if ( ! map ) {
1063
+ return false ;
1064
+ }
1065
+ let exists = false ;
1066
+ map . forEachValue ( fileName => {
1067
+ if ( ! exists && ts . startsWith ( fileName , directoryPath ) && fileName [ directoryPath . length ] === "/" ) {
1068
+ exists = true ;
1069
+ }
1070
+ } ) ;
1071
+ return exists ;
1077
1072
}
1078
1073
1079
1074
interface HarnessOptions {
You can’t perform that action at this time.
0 commit comments