Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pat Thoyts committed Oct 1, 2010
1 parent 9b9784c commit 442dada
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compat/mingw.c
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 442dada

Please sign in to comment.