@@ -182,7 +182,7 @@ namespace ts {
182182 return matchFiles ( path , extensions , excludes , includes , /*useCaseSensitiveFileNames*/ false , shell . CurrentDirectory , getAccessibleFileSystemEntries ) ;
183183 }
184184
185- return {
185+ const wscriptSystem : System = {
186186 args,
187187 newLine : "\r\n" ,
188188 useCaseSensitiveFileNames : false ,
@@ -200,8 +200,8 @@ namespace ts {
200200 directoryExists ( path : string ) {
201201 return fso . FolderExists ( path ) ;
202202 } ,
203- createDirectory ( this : System , directoryName : string ) {
204- if ( ! this . directoryExists ( directoryName ) ) {
203+ createDirectory ( directoryName : string ) {
204+ if ( ! wscriptSystem . directoryExists ( directoryName ) ) {
205205 fso . CreateFolder ( directoryName ) ;
206206 }
207207 } ,
@@ -221,6 +221,7 @@ namespace ts {
221221 }
222222 }
223223 } ;
224+ return wscriptSystem ;
224225 }
225226
226227 function getNodeSystem ( ) : System {
@@ -439,7 +440,7 @@ namespace ts {
439440 return filter < string > ( _fs . readdirSync ( path ) , p => fileSystemEntryExists ( combinePaths ( path , p ) , FileSystemEntryKind . Directory ) ) ;
440441 }
441442
442- return {
443+ const nodeSystem : System = {
443444 args : process . argv . slice ( 2 ) ,
444445 newLine : _os . EOL ,
445446 useCaseSensitiveFileNames : useCaseSensitiveFileNames ,
@@ -500,8 +501,8 @@ namespace ts {
500501 } ,
501502 fileExists,
502503 directoryExists,
503- createDirectory ( this : System , directoryName : string ) {
504- if ( ! this . directoryExists ( directoryName ) ) {
504+ createDirectory ( directoryName : string ) {
505+ if ( ! nodeSystem . directoryExists ( directoryName ) ) {
505506 _fs . mkdirSync ( directoryName ) ;
506507 }
507508 } ,
@@ -549,6 +550,7 @@ namespace ts {
549550 return _fs . realpathSync ( path ) ;
550551 }
551552 } ;
553+ return nodeSystem ;
552554 }
553555
554556 function getChakraSystem ( ) : System {
0 commit comments