@@ -47,90 +47,14 @@ public void Verify(string? workingDirectory, string? projectRootDirectory)
4747 {
4848 this . log . Debug ( $ "Trying to find configuration file { item } at '{ directoryPath } '") ;
4949
50- var configurationFilePath = item ;
51- if ( ! PathHelper . IsPathRooted ( configurationFilePath ) )
50+ string configurationFilePath ;
51+ if ( ! PathHelper . IsPathRooted ( item ) )
5252 {
5353 if ( string . IsNullOrEmpty ( directoryPath ) )
5454 {
55- throw new WarningException (
56- $ "The configuration file '{ configurationFilePath } ' is relative and no directory path known."
57- ) ;
58- }
59- configurationFilePath = Path . Combine ( directoryPath , configurationFilePath ) ;
60- }
61-
62- if ( fileSystem . File . Exists ( configurationFilePath ) )
63- {
64- this . log . Info ( $ "Found configuration file at '{ configurationFilePath } '") ;
65- return configurationFilePath ;
66- }
67-
68- this . log . Debug ( $ "Configuration file { configurationFilePath } not found at '{ directoryPath } '") ;
69- }
70-
71- return null ;
72- }
73-
74- public string ? GetConfigurationFileTemp ( string ? directoryPath )
75- {
76- // If configuration file overriden and its exists, return it
77- if ( ! string . IsNullOrWhiteSpace ( this . ConfigurationFile ) &&
78- PathHelper . IsPathRooted ( this . ConfigurationFile ) &&
79- fileSystem . File . Exists ( this . ConfigurationFile ) )
80- {
81- return this . ConfigurationFile ;
82- }
83-
84- if ( directoryPath is null ) return null ;
85-
86- string [ ] candidates = ! string . IsNullOrWhiteSpace ( this . ConfigurationFile )
87- ? [ this . ConfigurationFile , .. this . SupportedConfigFileNames ]
88- : this . SupportedConfigFileNames ;
89-
90- foreach ( var fileName in candidates )
91- {
92- this . log . Debug ( $ "Trying to find configuration file { fileName } at '{ directoryPath } '") ;
93- if ( directoryPath != null && fileSystem . Directory . Exists ( directoryPath ) )
94- {
95- var files = fileSystem . Directory . GetFiles ( directoryPath ) ;
96-
97- var matchingFile = files . FirstOrDefault ( file =>
98- string . Equals ( fileSystem . Path . GetFileName ( file ) , fileName , StringComparison . OrdinalIgnoreCase ) ) ;
99-
100- if ( matchingFile != null )
101- {
102- this . log . Info ( $ "Found configuration file at '{ matchingFile } '") ;
103- return matchingFile ;
55+ this . log . Info ( $ "The configuration file '{ item } ' is relative and no directory path known.") ;
56+ continue ;
10457 }
105- }
106-
107- this . log . Debug ( $ "Configuration file { fileName } not found at '{ directoryPath } '") ;
108- }
109-
110- return null ;
111- }
112-
113- public string ? GetConfigurationFileCombined ( string ? directoryPath )
114- {
115- if ( ! string . IsNullOrWhiteSpace ( this . ConfigurationFile ) &&
116- PathHelper . IsPathRooted ( this . ConfigurationFile ) &&
117- fileSystem . File . Exists ( this . ConfigurationFile ) )
118- {
119- return this . ConfigurationFile ;
120- }
121-
122- if ( directoryPath is null ) return null ;
123-
124- string [ ] configurationFilePaths = string . IsNullOrWhiteSpace ( this . ConfigurationFile )
125- ? this . SupportedConfigFileNames : [ this . ConfigurationFile , .. this . SupportedConfigFileNames ] ;
126-
127- foreach ( var item in configurationFilePaths )
128- {
129- this . log . Debug ( $ "Trying to find configuration file { item } at '{ directoryPath } '") ;
130-
131- string configurationFilePath ;
132- if ( ! PathHelper . IsPathRooted ( item ) )
133- {
13458 configurationFilePath = Path . Combine ( directoryPath , item ) ;
13559 }
13660 else
0 commit comments