Commit 911109ca authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

macosx: Fix file:// in the open panel

It's either paths or uris.
(cherry picked from commit 6148ec64)
Signed-off-by: default avatarDerk-Jan Hartman <hartman@videolan.org>
parent 5071bd0b
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#import "output.h" #import "output.h"
#import "eyetv.h" #import "eyetv.h"
#include <vlc_url.h>
#define setEyeTVUnconnected \ #define setEyeTVUnconnected \
[o_capture_lbl setStringValue: _NS("No device connected")]; \ [o_capture_lbl setStringValue: _NS("No device connected")]; \
[o_capture_long_lbl setStringValue: _NS("VLC could not detect any EyeTV compatible device.\n\nCheck the device's connection, make sure that the latest EyeTV software is installed and try again.")]; \ [o_capture_long_lbl setStringValue: _NS("VLC could not detect any EyeTV compatible device.\n\nCheck the device's connection, make sure that the latest EyeTV software is installed and try again.")]; \
...@@ -511,30 +513,26 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -511,30 +513,26 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (void)openFilePathChanged:(NSNotification *)o_notification - (void)openFilePathChanged:(NSNotification *)o_notification
{ {
NSString *o_mrl_string;
NSString *o_filename = [o_file_path stringValue]; NSString *o_filename = [o_file_path stringValue];
NSString *o_ext = [o_filename pathExtension];
bool b_stream = [o_file_stream state]; bool b_stream = [o_file_stream state];
BOOL b_dir = NO; BOOL b_dir = NO;
[[NSFileManager defaultManager] fileExistsAtPath:o_filename isDirectory:&b_dir]; [[NSFileManager defaultManager] fileExistsAtPath:o_filename isDirectory:&b_dir];
char *psz_uri = make_URI([o_filename UTF8String]);
if( !psz_uri ) return;
NSMutableString *o_mrl_string = [NSMutableString stringWithUTF8String: psz_uri ];
NSRange offile = [o_mrl_string rangeOfString:@"file"];
free( psz_uri );
if( b_dir ) if( b_dir )
{ {
o_mrl_string = [NSString stringWithFormat: @"directory://%@/", o_filename]; [o_mrl_string replaceCharactersInRange:offile withString: @"directory"];
} }
else if( [o_ext isEqualToString: @"bin"] || else if( b_stream )
[o_ext isEqualToString: @"cue"] ||
[o_ext isEqualToString: @"vob"] ||
[o_ext isEqualToString: @"iso"] )
{
o_mrl_string = o_filename;
}
else
{ {
o_mrl_string = [NSString stringWithFormat: @"%s://%@", [o_mrl_string replaceCharactersInRange:offile withString: @"stream"];
b_stream ? "stream" : "file",
o_filename];
} }
[o_mrl setStringValue: o_mrl_string]; [o_mrl setStringValue: o_mrl_string];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment