Skip to content

Commit 442dada

Browse files
committed
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>
1 parent 9b9784c commit 442dada

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compat/mingw.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ void mingw_open_html(const char *unixpath)
14171417
const char *, const char *, const char *, INT);
14181418
T ShellExecute;
14191419
HMODULE shell32;
1420+
int r;
14201421

14211422
shell32 = LoadLibrary("shell32.dll");
14221423
if (!shell32)
@@ -1426,9 +1427,12 @@ void mingw_open_html(const char *unixpath)
14261427
die("cannot run browser");
14271428

14281429
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);
14311431
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+
}
14321436
}
14331437

14341438
int link(const char *oldpath, const char *newpath)

0 commit comments

Comments
 (0)