[geany/geany] 825427: Merge pull request #937 from eht16/win32_open_uri_error_handling

Enrico Tröger git-noreply at xxxxx
Sat Mar 12 15:22:28 UTC 2016


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sat, 12 Mar 2016 15:22:28 UTC
Commit:      8254271b3373ec0e53ce2b07c206ebd6418e61fb
             https://github.com/geany/geany/commit/8254271b3373ec0e53ce2b07c206ebd6418e61fb

Log Message:
-----------
Merge pull request #937 from eht16/win32_open_uri_error_handling

Add error reporting for opening URIs on Windows


Modified Paths:
--------------
    src/win32.c

Modified: src/win32.c
10 lines changed, 9 insertions(+), 1 deletions(-)
===================================================================
@@ -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);
+	}
 }
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list