Commit c3dad7ff authored by David Fuhrmann's avatar David Fuhrmann

macosx: messages panel: save log as text file instead of rtf

Those rtf files were awful to read, and rather unhandy. Switch to
plain txt which should make debugging more easy.
parent 6f31dda7
......@@ -144,18 +144,16 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
[saveFolderPanel setCanSelectHiddenExtension: NO];
[saveFolderPanel setCanCreateDirectories: YES];
[saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"rtf"]];
[saveFolderPanel setNameFieldStringValue:[NSString stringWithFormat: _NS("VLC Debug Log (%s).rtf"), VERSION_MESSAGE]];
[saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"txt"]];
[saveFolderPanel setNameFieldStringValue:[NSString stringWithFormat: _NS("VLC Debug Log (%s).txt"), VERSION_MESSAGE]];
[saveFolderPanel beginSheetModalForWindow: self.window completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton) {
NSUInteger count = [_messageArray count];
NSMutableAttributedString * string = [[NSMutableAttributedString alloc] init];
NSMutableString *string = [[NSMutableString alloc] init];
for (NSUInteger i = 0; i < count; i++)
[string appendAttributedString: [_messageArray objectAtIndex:i]];
NSData *data = [string RTFFromRange:NSMakeRange(0, [string length])
documentAttributes:[NSDictionary dictionaryWithObject: NSRTFTextDocumentType forKey: NSDocumentTypeDocumentAttribute]];
[string appendString: [[_messageArray objectAtIndex:i] string]];
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
if ([data writeToFile: [[saveFolderPanel URL] path] atomically: YES] == NO)
msg_Warn(VLCIntf, "Error while saving the debug log");
}
......
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