Fixed sorting for non-0 padded files.

CQTexperiment
vspader 2009-02-28 09:41:37 -08:00
parent 983699ab2f
commit 3b9d20fdc5
3 changed files with 17 additions and 6 deletions

View File

@ -201,15 +201,11 @@
NSArray *sortedURLs; NSArray *sortedURLs;
if (sort == YES) if (sort == YES)
{ {
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"absoluteString" ascending:YES]; sortedURLs = [expandedURLs sortedArrayUsingSelector:@selector(compareTrackNumbers:)];
sortedURLs = [expandedURLs sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
[sortDescriptor release];
} }
else else
{ {
sortedURLs = [expandedURLs copy]; sortedURLs = expandedURLs;
} }
for (url in sortedURLs) for (url in sortedURLs)

View File

@ -14,3 +14,9 @@
- (NSComparisonResult)compareTrackNumbers:(NSString *)aString; - (NSComparisonResult)compareTrackNumbers:(NSString *)aString;
@end @end
@interface NSURL (CogSort)
- (NSComparisonResult)compareTrackNumbers:(NSURL *)aURL;
@end

View File

@ -19,3 +19,12 @@
} }
@end @end
@implementation NSURL (CogSort)
- (NSComparisonResult)compareTrackNumbers:(NSURL *)aURL
{
return [[self absoluteString] compareTrackNumbers:[aURL absoluteString]];
}
@end