vlc | branch: master | David Fuhrmann <[email protected]> | Sun Aug 
19 18:08:52 2012 +0200| [9f5bed00476a6d438a1abff4a31397ae7af88cad] | committer: 
David Fuhrmann

macosx: save debug log to rtf instead rtfd

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f5bed00476a6d438a1abff4a31397ae7af88cad
---

 modules/gui/macosx/intf.m |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 586b1de..1e72f49 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -2117,13 +2117,12 @@ unsigned int CocoaKeyToVLC( unichar i_key )
 
     [saveFolderPanel setCanSelectHiddenExtension: NO];
     [saveFolderPanel setCanCreateDirectories: YES];
-    [saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"rtfd"]];
-    [saveFolderPanel beginSheetForDirectory:nil file: [NSString 
stringWithFormat: _NS("VLC Debug Log (%s).rtfd"), VERSION_MESSAGE] 
modalForWindow: o_msgs_panel modalDelegate:self 
didEndSelector:@selector(saveDebugLogAsRTF:returnCode:contextInfo:) 
contextInfo:nil];
+    [saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"rtf"]];
+    [saveFolderPanel beginSheetForDirectory:nil file: [NSString 
stringWithFormat: _NS("VLC Debug Log (%s).rtf"), VERSION_MESSAGE] 
modalForWindow: o_msgs_panel modalDelegate:self 
didEndSelector:@selector(saveDebugLogAsRTF:returnCode:contextInfo:) 
contextInfo:nil];
 }
 
 - (void)saveDebugLogAsRTF: (NSSavePanel *)sheet returnCode: (int)returnCode 
contextInfo: (void *)contextInfo
 {
-    BOOL b_returned;
     if( returnCode == NSOKButton )
     {
         NSUInteger count = [o_msg_arr count];
@@ -2132,11 +2131,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
         {
             [string appendAttributedString: [o_msg_arr objectAtIndex: i]];
         }
-        b_returned = [[string RTFDFileWrapperFromRange:NSMakeRange( 0, [string 
length] ) documentAttributes:[NSDictionary dictionaryWithObject: 
NSRTFDTextDocumentType forKey: NSDocumentTypeDocumentAttribute]] 
writeToFile:[[sheet URL] path] atomically:YES updateFilenames:NO];
-        [string release];
 
-        if(! b_returned )
+        NSData *data = [string RTFFromRange:NSMakeRange( 0, [string length] )
+                         documentAttributes:[NSDictionary 
dictionaryWithObject: NSRTFTextDocumentType forKey: 
NSDocumentTypeDocumentAttribute]];        
+
+        if( [data writeToFile: [[sheet URL] path] atomically: YES] == NO )
             msg_Warn( p_intf, "Error while saving the debug log" );
+
+        [string release];
     }
 }
 

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to