[Scummvm-git-logs] scummvm master -> 9ebb91411aaf57c0ccc5667b2f0743c5454fd1da

criezy criezy at scummvm.org
Sun Apr 21 12:01:52 CEST 2019


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
66ef22d555 MACOSX: Improve opening files from the Help menu
9ebb91411a CONFIGURE: Generate html README and NEWS by default on macOS


Commit: 66ef22d55504951c43f1641145431651bfab78f7
    https://github.com/scummvm/scummvm/commit/66ef22d55504951c43f1641145431651bfab78f7
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-04-21T11:01:34+01:00

Commit Message:
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.

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 466356b..1d5ab12 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"];
 	}
 }
 


Commit: 9ebb91411aaf57c0ccc5667b2f0743c5454fd1da
    https://github.com/scummvm/scummvm/commit/9ebb91411aaf57c0ccc5667b2f0743c5454fd1da
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-04-21T11:01:34+01:00

Commit Message:
CONFIGURE: Generate html README and NEWS by default on macOS

There was already a configure option to specify a output format other
than plain text, but this had to be specified explicitely when
executing configure. Now the ports can define a default other than
plain text.

On macOS now by default pandoc generate html output. It could
in theory also generate rtf, but those are not properly displayed
by TextEdit, and in addition TextEdit cannot handle link internal
to the document (such as for the TOC). But if we are fine with
no link for the TOC, we could pipe the pandoc html output with
textutil to generate the RTF documents.

Also this change allows to have an extension for the pandoc output
files. By default this is empty for plain text (as before) and
the same as the format otherwise (for example .rtf or .html).

Changed paths:
    .gitignore
    Makefile.common
    configure


diff --git a/.gitignore b/.gitignore
index ed6b6e0..2708700 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,7 +38,9 @@ lib*.a
 /scummvm-conf.cpp
 /tmp_*.cpp
 /README
+/README.html
 /NEWS
+/NEWS.html
 
 /build
 /staging
diff --git a/Makefile.common b/Makefile.common
index b058ae9..c6c47fd 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -13,7 +13,7 @@ all: $(EXECUTABLE).dwp
 endif
 
 ifdef USE_PANDOC
-all: README NEWS
+all: README$(PANDOCEXT) NEWS$(PANDOCEXT)
 endif
 
 ######################################################################
@@ -237,10 +237,10 @@ VERFILE := $(DISTDIR)/$(DISTNAME)/base/internal_version.h
 
 ifdef USE_PANDOC
 # Convert README.md and NEWS.md to plain text for any platform that might require it
-README: ${srcdir}/README.md
+README$(PANDOCEXT): ${srcdir}/README.md
 	$(QUIET_PANDOC)$(PANDOC) -f gfm -t $(PANDOCFORMAT) -o $@ $<
 
-NEWS: ${srcdir}/NEWS.md
+NEWS$(PANDOCEXT): ${srcdir}/NEWS.md
 	$(QUIET_PANDOC)$(PANDOC) -f gfm -t $(PANDOCFORMAT) -o $@ $<
 endif
 
@@ -275,7 +275,7 @@ dist-src: \
 # Common files
 DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING COPYING.BSD COPYING.LGPL COPYING.FREEFONT COPYRIGHT NEWS.md README.md)
 ifdef USE_PANDOC
-DIST_FILES_DOCS+=README NEWS
+DIST_FILES_DOCS+=README$(PANDOCEXT) NEWS$(PANDOCEXT)
 endif
 
 DIST_FILES_DOCS_languages=cz da de es fr it no-nb se
diff --git a/configure b/configure
index 1289b21..62b43d3 100755
--- a/configure
+++ b/configure
@@ -229,7 +229,8 @@ NASM=""
 _tainted_build=no
 PANDOC=""
 _pandocpath="$PATH"
-_pandocformat="plain"
+_pandocformat="default"
+_pandocext="default"
 # The following variables are automatically detected, and should not
 # be modified otherwise. Consider them read-only.
 _posix=no
@@ -2705,6 +2706,16 @@ case $_host_os in
 				echo "Could not determine path for Xcode Tools"
 			fi
 		fi
+
+		# Use pandoc to generate README and NEWS file for the bundle
+		# Also default to  HTML rather than plain text as it gives a nicer
+		# formating, especially for the README. We could consider using RTF
+		# as well, but TextEdit does not support links within the document,
+		# and having a TOC with links, which we do with html, is quite convenient.
+		_pandoc=yes
+		if test "$_pandocformat" = "default"; then
+			_pandocformat="html"
+		fi
 		;;
 	dreamcast)
 		append_var DEFINES "-D__DC__"
@@ -5141,6 +5152,19 @@ fi
 
 define_in_config_if_yes $_pandoc 'USE_PANDOC'
 
+# Default to plain text output for pandoc
+if test -z "$_pandocformat" -o "$_pandocformat" = "default"; then
+	_pandocformat="plain"
+fi
+
+if test "$_pandocext" = "default"; then
+	if test "$_pandocformat" = plain; then
+		_pandocext=""
+	else
+		_pandocext=".$_pandocformat"
+	fi
+fi
+
 #
 # Enable vkeybd / keymapper / event recorder
 #
@@ -5619,6 +5643,7 @@ NASM := $NASM
 NASMFLAGS := $NASMFLAGS
 PANDOC := $PANDOC
 PANDOCFORMAT := $_pandocformat
+PANDOCEXT := $_pandocext
 ZLIB_LIBS := $ZLIB_LIBS
 ZLIB_CFLAGS := $ZLIB_CFLAGS
 





More information about the Scummvm-git-logs mailing list