@@ -195,7 +195,10 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
195195 // match everything before and after search term using supported wildcard '*', ie. *searchterm*
196196 incompleteName = "*" + incompleteName . Substring ( 1 ) ;
197197 }
198-
198+
199+ var folderList = new List < Result > ( ) ;
200+ var fileList = new List < Result > ( ) ;
201+
199202 try
200203 {
201204 // search folder and add results
@@ -206,11 +209,14 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
206209 {
207210 if ( ( fileSystemInfo . Attributes & FileAttributes . Hidden ) == FileAttributes . Hidden ) continue ;
208211
209- var result =
210- fileSystemInfo is DirectoryInfo
211- ? CreateFolderResult ( fileSystemInfo . Name , fileSystemInfo . FullName , query )
212- : CreateFileResult ( fileSystemInfo . FullName , query ) ;
213- results . Add ( result ) ;
212+ if ( fileSystemInfo is DirectoryInfo )
213+ {
214+ folderList . Add ( CreateFolderResult ( fileSystemInfo . Name , fileSystemInfo . FullName , query ) ) ;
215+ }
216+ else
217+ {
218+ fileList . Add ( CreateFileResult ( fileSystemInfo . FullName , query ) ) ;
219+ }
214220 }
215221 }
216222 catch ( Exception e )
@@ -225,7 +231,8 @@ fileSystemInfo is DirectoryInfo
225231 throw ;
226232 }
227233
228- return results ;
234+ // Intial ordering, this order can be updated later by UpdateResultView.MainViewModel based on history of user selection.
235+ return results . Concat ( folderList . OrderBy ( x => x . Title ) ) . Concat ( fileList . OrderBy ( x => x . Title ) ) . ToList ( ) ;
229236 }
230237
231238 private static Result CreateFileResult ( string filePath , Query query )
0 commit comments