@@ -295,11 +295,26 @@ namespace ts {
295
295
reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . The_current_host_does_not_support_the_0_option , "--project" ) , /* compilerHost */ undefined ) ;
296
296
return sys . exit ( ExitStatus . DiagnosticsPresent_OutputsSkipped ) ;
297
297
}
298
- configFileName = normalizePath ( combinePaths ( commandLine . options . project , "tsconfig.json" ) ) ;
299
298
if ( commandLine . fileNames . length !== 0 ) {
300
299
reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . Option_project_cannot_be_mixed_with_source_files_on_a_command_line ) , /* compilerHost */ undefined ) ;
301
300
return sys . exit ( ExitStatus . DiagnosticsPresent_OutputsSkipped ) ;
302
301
}
302
+
303
+ const fileOrDirectory = normalizePath ( commandLine . options . project ) ;
304
+ if ( ! fileOrDirectory /* current directory "." */ || sys . directoryExists ( fileOrDirectory ) ) {
305
+ configFileName = combinePaths ( fileOrDirectory , "tsconfig.json" ) ;
306
+ if ( ! sys . fileExists ( configFileName ) ) {
307
+ reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0 , commandLine . options . project ) , /* compilerHost */ undefined ) ;
308
+ return sys . exit ( ExitStatus . DiagnosticsPresent_OutputsSkipped ) ;
309
+ }
310
+ }
311
+ else {
312
+ configFileName = fileOrDirectory ;
313
+ if ( ! sys . fileExists ( configFileName ) ) {
314
+ reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . The_specified_path_does_not_exist_Colon_0 , commandLine . options . project ) , /* compilerHost */ undefined ) ;
315
+ return sys . exit ( ExitStatus . DiagnosticsPresent_OutputsSkipped ) ;
316
+ }
317
+ }
303
318
}
304
319
else if ( commandLine . fileNames . length === 0 && isJSONSupported ( ) ) {
305
320
const searchPath = normalizePath ( sys . getCurrentDirectory ( ) ) ;
0 commit comments