@@ -101,6 +101,8 @@ int RunCreate(IEnumerable<string> args)
101
101
return ExitFailure ;
102
102
}
103
103
104
+ WriteLine ( $ "Wrote { complogFilePath } ") ;
105
+
104
106
return convertResult . Succeeded ? ExitSuccess : ExitFailure ;
105
107
}
106
108
catch ( OptionException e )
@@ -701,12 +703,13 @@ static void CheckCompilerLogReader(CompilerLogReader reader, bool checkVersion)
701
703
string GetLogFilePath ( List < string > extra , bool includeCompilerLogs = true )
702
704
{
703
705
string ? logFilePath ;
706
+ bool foundMultiple = false ;
704
707
IEnumerable < string > args = Array . Empty < string > ( ) ;
705
708
string baseDirectory = CurrentDirectory ;
706
709
var printFile = false ;
707
710
if ( extra . Count == 0 )
708
711
{
709
- logFilePath = FindLogFilePath ( baseDirectory , includeCompilerLogs ) ;
712
+ ( logFilePath , foundMultiple ) = FindLogFilePath ( baseDirectory , includeCompilerLogs ) ;
710
713
printFile = true ;
711
714
}
712
715
else
@@ -716,7 +719,7 @@ string GetLogFilePath(List<string> extra, bool includeCompilerLogs = true)
716
719
if ( string . IsNullOrEmpty ( Path . GetExtension ( logFilePath ) ) && Directory . Exists ( logFilePath ) )
717
720
{
718
721
baseDirectory = logFilePath ;
719
- logFilePath = FindLogFilePath ( baseDirectory , includeCompilerLogs ) ;
722
+ ( logFilePath , foundMultiple ) = FindLogFilePath ( baseDirectory , includeCompilerLogs ) ;
720
723
printFile = true ;
721
724
}
722
725
}
@@ -729,6 +732,11 @@ string GetLogFilePath(List<string> extra, bool includeCompilerLogs = true)
729
732
// If the file wasn't explicitly specified let the user know what file we are using
730
733
if ( printFile )
731
734
{
735
+ if ( foundMultiple )
736
+ {
737
+ WriteLine ( $ "Found multiple log files in { baseDirectory } ") ;
738
+ }
739
+
732
740
WriteLine ( $ "Using { logFilePath } ") ;
733
741
}
734
742
@@ -750,7 +758,7 @@ string GetLogFilePath(List<string> extra, bool includeCompilerLogs = true)
750
758
throw new OptionException ( $ "Not a valid log file { logFilePath } ", "log" ) ;
751
759
}
752
760
753
- static string ? FindLogFilePath ( string baseDirectory , bool includeCompilerLogs = true ) =>
761
+ static ( string ? FilePath , bool FoundMultiple ) FindLogFilePath ( string baseDirectory , bool includeCompilerLogs = true ) =>
754
762
includeCompilerLogs
755
763
? FindFirstFileWithPattern ( baseDirectory , "*.complog" , "*.binlog" , "*.sln" , "*.csproj" , ".vbproj" )
756
764
: FindFirstFileWithPattern ( baseDirectory , "*.binlog" , "*.sln" , "*.csproj" , ".vbproj" ) ;
@@ -778,21 +786,21 @@ static string GetLogFilePathAfterBuild(string appDataDirectory, string baseDirec
778
786
static OptionException CreateOptionException ( ) => new ( "Need a file to analyze" , "log" ) ;
779
787
}
780
788
781
- static string ? FindFirstFileWithPattern ( string baseDirectory , params string [ ] patterns )
789
+ static ( string ? FilePath , bool FoundMultiple ) FindFirstFileWithPattern ( string baseDirectory , params string [ ] patterns )
782
790
{
783
791
foreach ( var pattern in patterns )
784
792
{
785
- var path = Directory
793
+ using var e = Directory
786
794
. EnumerateFiles ( baseDirectory , pattern )
787
795
. OrderBy ( x => Path . GetFileName ( x ) , PathUtil . Comparer )
788
- . FirstOrDefault ( ) ;
789
- if ( path is not null )
796
+ . GetEnumerator ( ) ;
797
+ if ( e . MoveNext ( ) )
790
798
{
791
- return path ;
799
+ return ( e . Current , e . MoveNext ( ) ) ;
792
800
}
793
801
}
794
802
795
- return null ;
803
+ return ( null , false ) ;
796
804
}
797
805
798
806
string GetBaseOutputPath ( string ? baseOutputPath , string ? directoryName = null )
0 commit comments