aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/macosx
diff options
context:
space:
mode:
authorThierry Crozat2019-04-21 00:28:32 +0100
committerThierry Crozat2019-04-21 11:01:34 +0100
commit66ef22d55504951c43f1641145431651bfab78f7 (patch)
tree9f0dc8d7eb609047168992efe44fe76f96b8e725 /backends/platform/sdl/macosx
parenta663930dd062edd8bfc217fb19a5cbce37705ece (diff)
downloadscummvm-rg350-66ef22d55504951c43f1641145431651bfab78f7.tar.gz
scummvm-rg350-66ef22d55504951c43f1641145431651bfab78f7.tar.bz2
scummvm-rg350-66ef22d55504951c43f1641145431651bfab78f7.zip
MACOSX: Improve opening files from the Help menu
Now in addition to rtf extension and no extension, it also looks for the html and md extensions. Also unless the extension is RTF or HTML, which are widely recognized, it explicitely indicate that the file should be open with TextEdit. This fixes bug #10938, with opening the README and NEWS file from the Help menu failing when the bundle was compiled without using pandoc and thus the only files available are the markdown ones. Support for the html extension is to prepare for a future change to have a nicer README than the plain text one.
Diffstat (limited to 'backends/platform/sdl/macosx')
-rw-r--r--backends/platform/sdl/macosx/appmenu_osx.mm15
1 files changed, 13 insertions, 2 deletions
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
index 466356b06d..1d5ab12792 100644
--- a/backends/platform/sdl/macosx/appmenu_osx.mm
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
@@ -62,11 +62,22 @@ typedef unsigned long NSUInteger;
static void openFromBundle(NSString *file) {
NSString *path = [[NSBundle mainBundle] pathForResource:file ofType:@"rtf"];
if (!path) {
- path = [[NSBundle mainBundle] pathForResource:file ofType:@""];
+ path = [[NSBundle mainBundle] pathForResource:file ofType:@"html"];
+ if (!path) {
+ path = [[NSBundle mainBundle] pathForResource:file ofType:@""];
+ if (!path)
+ path = [[NSBundle mainBundle] pathForResource:file ofType:@"md"];
+ }
}
if (path) {
- [[NSWorkspace sharedWorkspace] openFile:path];
+ // RTF and HTML files are widely recognized and we can rely on the default
+ // file association working for those. For the other ones this might not be
+ // the case so we explicitely indicate they should be open with TextEdit.
+ if ([path hasSuffix:@".html"] || [path hasSuffix:@".rtf"])
+ [[NSWorkspace sharedWorkspace] openFile:path];
+ else
+ [[NSWorkspace sharedWorkspace] openFile:path withApplication:@"TextEdit"];
}
}