Sort Results NSFileManager

I am wondering how to get the NSFileManager list to display the results in the order in which they are sorted. By default, this code is:

NSFileManager *fileManager = [[NSFileManager alloc] init];

NSError *foundErrors = nil;

NSArray *contentsOfDockDirectory = [fileManager contentsOfDirectoryAtPath:@"/Users/me/Desktop error:&foundErrors];

Creates an NSArray that lists it in this type of order: 1, 100, 2, 200, etc. However, the Finder shows the correct sort, so this is: 1, 2, 100, 200, etc.

Is there a way to sort NSArray or NSFileManager to have a list in that order?

+3
source share
1 answer

The line programming guide has the section "Sorting lines such as Finder" that you are looking for.

+12
source

Source: https://habr.com/ru/post/1710534/


All Articles