From 2f5eca2cfd0def376e7430f8f71ce9401cf2c0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 6 Mar 2016 11:16:52 +0100 Subject: [PATCH] Add error reporting for opening URIs on Windows Before it silently failed if there was any error. Now at least a console warning is logged. --- src/win32.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/win32.c b/src/win32.c index 19ac6e48..903ebe63 100644 --- a/src/win32.c +++ b/src/win32.c @@ -785,6 +785,7 @@ gint win32_check_write_permission(const gchar *dir) /* Just a simple wrapper function to open a browser window */ void win32_open_browser(const gchar *uri) { + gint ret; if (strncmp(uri, "file://", 7) == 0) { uri += 7; @@ -794,7 +795,14 @@ void win32_open_browser(const gchar *uri) uri++; } } - ShellExecute(NULL, "open", uri, NULL, NULL, SW_SHOWNORMAL); + ret = (gint) ShellExecute(NULL, "open", uri, NULL, NULL, SW_SHOWNORMAL); + if (ret <= 32) + { + gchar *err = g_win32_error_message(GetLastError()); + /* TODO add a GUI warning that opening an URI failed */ + g_warning("ShellExecute failed opening \"%s\" (code %d): %s", uri, ret, err); + g_free(err); + } }