[vlc-devel] commit: macosx: Fix file:// in the open panel (Derk-Jan Hartman )
git version control
git at videolan.org
Fri Jun 26 17:11:10 CEST 2009
vlc | branch: 1.0-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Fri Jun 26 16:14:50 2009 +0200| [911109ca493d98594eddfcb6e20af3a6c2d5adb1] | committer: Derk-Jan Hartman
macosx: Fix file:// in the open panel
It's either paths or uris.
(cherry picked from commit 6148ec643bc69b4efd59783c1d7694a51e3b5c8d)
Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=911109ca493d98594eddfcb6e20af3a6c2d5adb1
---
modules/gui/macosx/open.m | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index dcb22bc..ea01ab8 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -45,6 +45,8 @@
#import "output.h"
#import "eyetv.h"
+#include <vlc_url.h>
+
#define setEyeTVUnconnected \
[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.")]; \
@@ -511,30 +513,26 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (void)openFilePathChanged:(NSNotification *)o_notification
{
- NSString *o_mrl_string;
NSString *o_filename = [o_file_path stringValue];
- NSString *o_ext = [o_filename pathExtension];
bool b_stream = [o_file_stream state];
BOOL b_dir = NO;
-
+
[[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 )
{
- o_mrl_string = [NSString stringWithFormat: @"directory://%@/", o_filename];
- }
- else if( [o_ext isEqualToString: @"bin"] ||
- [o_ext isEqualToString: @"cue"] ||
- [o_ext isEqualToString: @"vob"] ||
- [o_ext isEqualToString: @"iso"] )
- {
- o_mrl_string = o_filename;
+ [o_mrl_string replaceCharactersInRange:offile withString: @"directory"];
}
- else
+ else if( b_stream )
{
- o_mrl_string = [NSString stringWithFormat: @"%s://%@",
- b_stream ? "stream" : "file",
- o_filename];
+ [o_mrl_string replaceCharactersInRange:offile withString: @"stream"];
}
[o_mrl setStringValue: o_mrl_string];
}
More information about the vlc-devel
mailing list