[Scummvm-git-logs] scummvm master -> 36908e0fcd49e713b301b56c3c32f19f31c4ec39
criezy
criezy at scummvm.org
Sat Aug 28 19:15:09 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
36908e0fcd OSX: Prefer the manual bundled with the application
Commit: 36908e0fcd49e713b301b56c3c32f19f31c4ec39
https://github.com/scummvm/scummvm/commit/36908e0fcd49e713b301b56c3c32f19f31c4ec39
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-08-28T20:14:57+01:00
Commit Message:
OSX: Prefer the manual bundled with the application
The User Manual Help menu item now opens the pdf bundled with the
application if present, and only opens the website otherwise.
The bundled documentation is preferred as:
- This will work even with no internet access
- This is future proof and will still work in 10 years when the
website URL might have changed or the website may be down.
- This ensure we get the doc that corresponds to the version of
ScummVM being used.
Changed paths:
backends/platform/sdl/macosx/appmenu_osx.mm
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
index 598e7272b6..cf4c3d0000 100644
--- a/backends/platform/sdl/macosx/appmenu_osx.mm
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
@@ -135,6 +135,21 @@ static void openFromBundle(NSString *file) {
}
- (void)openUserManual {
+ // If present locally in the bundle, open that file.
+ if ([[NSFileManager defaultManager] respondsToSelector:@selector(contentsOfDirectoryAtPath:error:)]) {
+ NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
+ NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:bundlePath error:nil];
+ NSEnumerator *dirEnum = [dirContents objectEnumerator];
+ NSString *file;
+ while (file = [dirEnum nextObject]) {
+ if ([file hasPrefix:@"ScummVM Manual"] && [file hasSuffix:@".pdf"]) {
+ [[NSWorkspace sharedWorkspace] openFile:[bundlePath stringByAppendingPathComponent:file]];
+ return;
+ }
+ }
+ }
+
+ // Otherwise try to access the only version.
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://docs.scummvm.org/"]];
}
More information about the Scummvm-git-logs
mailing list