Skip to content

Commit bcd5f81

Browse files
committed
Sort themes
1 parent ac32a59 commit bcd5f81

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

MacDown/Code/Utility/MPUtilities.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,22 @@
4747
name]];
4848
}
4949

50-
NSArray *MPListEntriesForDirectory(
50+
NSArray<NSString *> *MPListEntriesForDirectory(
5151
NSString *dirName, NSString *(^processor)(NSString *absolutePath))
5252
{
5353
NSString *dirPath = MPDataDirectory(dirName);
5454

5555
NSError *error = nil;
5656
NSFileManager *manager = [NSFileManager defaultManager];
57-
NSArray *fileNames = [manager contentsOfDirectoryAtPath:dirPath
58-
error:&error];
57+
NSArray<NSString *> *fileNames = [manager contentsOfDirectoryAtPath:dirPath
58+
error:&error];
5959
if (error || !fileNames.count)
6060
return @[];
61+
62+
SEL sortSelector = @selector(localizedStandardCompare:);
63+
fileNames = [fileNames sortedArrayUsingSelector:sortSelector];
6164

62-
NSMutableArray *items = [[NSMutableArray alloc] init];
65+
NSMutableArray<NSString *> *items = [[NSMutableArray alloc] init];
6366
for (NSString *fileName in fileNames)
6467
{
6568
NSString *item = [NSString pathWithComponents:@[dirPath, fileName]];

0 commit comments

Comments
 (0)