diff --git a/.github/ISSUE_TEMPLATE/2_bug_report_macos.md b/.github/ISSUE_TEMPLATE/2_bug_report_macos.md index d33c52bbba327..a61972d1b0716 100644 --- a/.github/ISSUE_TEMPLATE/2_bug_report_macos.md +++ b/.github/ISSUE_TEMPLATE/2_bug_report_macos.md @@ -31,9 +31,11 @@ differes from your own. ### Log file -Make a log file made with -v -v or --log-file=output.txt, paste it to -https://0x0.st/ or attach it to the github issue, and replace this text with a -link to it. +Make a log file made with -v -v or --log-file=output.txt. If you use the Bundle +from a version later than 0.32 a default log is created for your last run at +~/Library/Logs/mpv.log. You can jump to that file via the Help > Show log File… +menu. Paste the log to https://0x0.st/ or attach it to the github issue, and +replace this text with a link to it. In the case of a crash please provide the macOS Crash Report (Backtrace). diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index bcdad2ed41fcb..1d18638f2ae8a 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -652,6 +652,9 @@ Program Behavior can be raised via ``--msg-level`` (the option cannot lower it below the forced minimum log level). + A special case is the macOS bundle, it will create a log file at + ``~/Library/Logs/mpv.log`` by default. + ``--config-dir=`` Force a different configuration directory. If this is set, the given directory is used to load configuration files, and all other configuration diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf b/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf index bdffa7a951bd6..618f87e24ba20 100644 --- a/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf +++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf @@ -1 +1,2 @@ player-operation-mode=pseudo-gui +log-file=~/Library/Logs/mpv.log diff --git a/osdep/macosx_menubar.m b/osdep/macosx_menubar.m index 349dd85aff656..11fdda5e53738 100644 --- a/osdep/macosx_menubar.m +++ b/osdep/macosx_menubar.m @@ -594,6 +594,15 @@ - (id)init @"key" : @"", @"target" : self, @"url" : @"https://github.com/mpv-player/mpv/issues/new/choose" + }], + [NSMutableDictionary dictionaryWithDictionary:@{ + @"name" : @"Show log File…", + @"action" : @"showFile:", + @"key" : @"", + @"target" : self, + @"file" : @"~/Library/Logs/mpv.log", + @"alertTitle" : @"No log File found.", + @"alertText" : @"You deactivated logging for the Bundle." }] ] } @@ -609,6 +618,7 @@ - (NSMenu *)mainMenu { NSMenu *mainMenu = [[NSMenu alloc] initWithTitle:@"MainMenu"]; [NSApp setServicesMenu:[[NSMenu alloc] init]]; + NSString* bundle = [[[NSProcessInfo processInfo] environment] objectForKey:@"MPVBUNDLE"]; for(id mMenu in menuTree) { NSMenu *menu = [[NSMenu alloc] initWithTitle:mMenu[@"name"]]; @@ -618,17 +628,25 @@ - (NSMenu *)mainMenu [mainMenu setSubmenu:menu forItem:mItem]; for(id subMenu in mMenu[@"menu"]) { + NSString *name = subMenu[@"name"]; + NSString *action = subMenu[@"action"]; + #if HAVE_MACOS_TOUCHBAR - if ([subMenu[@"action"] isEqual:@"toggleTouchBarCustomizationPalette:"]) { + if ([action isEqual:@"toggleTouchBarCustomizationPalette:"]) { if (![NSApp respondsToSelector:@selector(touchBar)]) continue; } #endif - if ([subMenu[@"name"] isEqual:@"separator"]) { + + if ([name isEqual:@"Show log File…"] && ![bundle isEqual:@"true"]) { + continue; + } + + if ([name isEqual:@"separator"]) { [menu addItem:[NSMenuItem separatorItem]]; } else { - NSMenuItem *iItem = [menu addItemWithTitle:subMenu[@"name"] - action:NSSelectorFromString(subMenu[@"action"]) + NSMenuItem *iItem = [menu addItemWithTitle:name + action:NSSelectorFromString(action) keyEquivalent:subMenu[@"key"]]; [iItem setTarget:subMenu[@"target"]]; [subMenu setObject:iItem forKey:@"menuItem"]; @@ -754,6 +772,25 @@ - (void)url:(NSMenuItem *)menuItem [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; } +- (void)showFile:(NSMenuItem *)menuItem +{ + NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSMutableDictionary *mItemDict = [self getDictFromMenuItem:menuItem]; + NSString *file = [mItemDict[@"file"] stringByExpandingTildeInPath]; + + if ([fileManager fileExistsAtPath:file]){ + NSURL *url = [NSURL fileURLWithPath:file]; + NSArray *urlArray = [NSArray arrayWithObjects:url, nil]; + + [workspace activateFileViewerSelectingURLs:urlArray]; + return; + } + + [self alertWithTitle:mItemDict[@"alertTitle"] + andText:mItemDict[@"alertText"]]; +} + - (void)alertWithTitle:(NSString *)title andText:(NSString *)text { NSAlert *alert = [[NSAlert alloc] init];