@matheusbsbs / matheus-bagliano / commits / 442dada22d
Fork 0

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>

Pat Thoyts committed Mar 18, 2010 at 21:45 UTC 442dada22d3b6e511d30b05a80bab153619e52a7
1 file changed +6 -2
compat/mingw.c
+6 -2
@@ -1417,6 +1417,7 @@ void mingw_open_html(const char *unixpath)
1417 const char *, const char *, const char *, INT);
1418 T ShellExecute;
1419 HMODULE shell32;
1420 + int r;
1421
1422 shell32 = LoadLibrary("shell32.dll");
1423 if (!shell32)
@@ -1426,9 +1427,12 @@ void mingw_open_html(const char *unixpath)
1427 die("cannot run browser");
1428
1429 printf("Launching default browser to display HTML ...\n");
1429 - ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
1430 -
1430 + r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
1431 FreeLibrary(shell32);
1432 + /* see the MSDN documentation referring to the result codes here */
1433 + if (r <= 32) {
1434 + die("failed to launch browser for %.*s", MAX_PATH, unixpath);
1435 + }
1436 }
1437
1438 int link(const char *oldpath, const char *newpath)