@@ -195,7 +195,10 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
195
195
// match everything before and after search term using supported wildcard '*', ie. *searchterm*
196
196
incompleteName = "*" + incompleteName . Substring ( 1 ) ;
197
197
}
198
-
198
+
199
+ var folderList = new List < Result > ( ) ;
200
+ var fileList = new List < Result > ( ) ;
201
+
199
202
try
200
203
{
201
204
// search folder and add results
@@ -206,11 +209,14 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
206
209
{
207
210
if ( ( fileSystemInfo . Attributes & FileAttributes . Hidden ) == FileAttributes . Hidden ) continue ;
208
211
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
+ }
214
220
}
215
221
}
216
222
catch ( Exception e )
@@ -225,7 +231,8 @@ fileSystemInfo is DirectoryInfo
225
231
throw ;
226
232
}
227
233
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 ( ) ;
229
236
}
230
237
231
238
private static Result CreateFileResult ( string filePath , Query query )
0 commit comments