summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorPat Thoyts <patthoyts@users.sourceforge.net>2010-03-18 21:45:19 (GMT)
committerPat Thoyts <patthoyts@users.sourceforge.net>2010-10-01 22:08:45 (GMT)
commit442dada22d3b6e511d30b05a80bab153619e52a7 (patch)
tree4190781434bd33398a8d4060c768c1e3d284ee34 /compat/mingw.c
parent9b9784cab9bba925ab35c7aa8d4e5967a4268093 (diff)
downloadgit-442dada22d3b6e511d30b05a80bab153619e52a7.zip
git-442dada22d3b6e511d30b05a80bab153619e52a7.tar.gz
git-442dada22d3b6e511d30b05a80bab153619e52a7.tar.bz2
MinGW: Report errors when failing to launch the html browser.
The mingw function to launch the system html browser is silent if the target file does not exist leaving the user confused. Make it display something. Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index ee8f3be..431e322 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1417,6 +1417,7 @@ void mingw_open_html(const char *unixpath)
const char *, const char *, const char *, INT);
T ShellExecute;
HMODULE shell32;
+ int r;
shell32 = LoadLibrary("shell32.dll");
if (!shell32)
@@ -1426,9 +1427,12 @@ void mingw_open_html(const char *unixpath)
die("cannot run browser");
printf("Launching default browser to display HTML ...\n");
- ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
-
+ r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
FreeLibrary(shell32);
+ /* see the MSDN documentation referring to the result codes here */
+ if (r <= 32) {
+ die("failed to launch browser for %.*s", MAX_PATH, unixpath);
+ }
}
int link(const char *oldpath, const char *newpath)