1
mirror of https://github.com/mpv-player/mpv synced 2024-10-06 14:54:02 +02:00

macosx_finder_args: fix file open order

When files are double clicked or drag and dropped to the mplayer2 icon they
can be in random order. This commit forces alphabetical order.

Opening them with command + down arrow already worked correctly.
This commit is contained in:
Stefano Pigozzi 2012-08-16 22:35:27 +02:00
parent 39e28570f1
commit c15270d3b9

View File

@ -36,8 +36,10 @@ bool psn_matches_current_process(char *psn_arg_to_check);
@implementation FileOpenDelegate
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
NSArray *sorted_filenames = [filenames
sortedArrayUsingSelector:@selector(compare:)];
files = talloc_zero(NULL, struct playlist);
for (NSString *filename in filenames)
for (NSString *filename in sorted_filenames)
playlist_add_file(files, [filename UTF8String]);
[NSApp stop:nil]; // stop the runloop (give back control to mplayer2 code)
}