@@ -64,15 +64,17 @@ public BuildContext(IFileSystem readFileSystem, IFileSystem writeFileSystem, str
6464
6565 private ( IDirectoryInfo , IFileInfo ) FindDocsFolderFromRoot ( IDirectoryInfo rootPath )
6666 {
67- var configurationPath = ReadFileSystem . FileInfo . New ( Path . Combine ( rootPath . FullName , "docset.yml" ) ) ;
68- if ( rootPath . Exists &&
69- ReadFileSystem . File . Exists ( Path . Combine ( rootPath . FullName , "docset.yml" ) ) )
70- return ( rootPath , configurationPath ) ;
71-
72- configurationPath = ReadFileSystem . FileInfo . New ( Path . Combine ( rootPath . FullName , "_docset.yml" ) ) ;
73- if ( rootPath . Exists &&
74- ReadFileSystem . File . Exists ( Path . Combine ( rootPath . FullName , "_docset.yml" ) ) )
75- return ( rootPath , configurationPath ) ;
67+ string [ ] files = [ "docset.yml" , "_docset.yml" ] ;
68+ string [ ] knownFolders = [ rootPath . FullName , Path . Combine ( rootPath . FullName , "docs" ) ] ;
69+ var mostLikelyTargets =
70+ from file in files
71+ from folder in knownFolders
72+ select Path . Combine ( folder , file ) ;
73+
74+ var knownConfigPath = mostLikelyTargets . FirstOrDefault ( ReadFileSystem . File . Exists ) ;
75+ var configurationPath = knownConfigPath is null ? null : ReadFileSystem . FileInfo . New ( knownConfigPath ) ;
76+ if ( configurationPath is not null )
77+ return ( configurationPath . Directory ! , configurationPath ) ;
7678
7779 configurationPath = rootPath
7880 . EnumerateFiles ( "*docset.yml" , SearchOption . AllDirectories )
0 commit comments