[geany/geany] cb669e: Use utils_get_uri_file_prefix() as file URI prefix

Enrico Tröger git-noreply at xxxxx
Sun Oct 29 15:20:53 UTC 2017


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 29 Oct 2017 15:20:53 UTC
Commit:      cb669e2a019eb5cb9a62e39c886ce928350ba699
             https://github.com/geany/geany/commit/cb669e2a019eb5cb9a62e39c886ce928350ba699

Log Message:
-----------
Use utils_get_uri_file_prefix() as file URI prefix

utils_get_uri_file_prefix() gives "file:///" for Windows and
"file://" for all other platforms. So we don't need "g_path_skip_root()"
any longer.
Using "g_path_skip_root()" removed the drive letter from the URI which
worked only as long as the file to be opened was on drive C: (or
whatever drive Windows considers as the default). But since local file
URIs including the drive letter are supported on Windows, we should use
it, so opening files on other drives works as well.

Fixes #1018.


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

Modified: src/build.c
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -1237,13 +1237,14 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data)
 		bc = get_build_cmd(doc, grp, cmd, NULL);
 		if (bc != NULL && strcmp(bc->command, "builtin") == 0)
 		{
+			const gchar *uri_file_prefix;
 			gchar *uri;
 			if (doc == NULL)
 				return;
-			uri = g_strconcat("file:///", g_path_skip_root(doc->file_name), NULL);
+			uri_file_prefix = utils_get_uri_file_prefix();
+			uri = g_strconcat(uri_file_prefix, doc->file_name, NULL);
 			utils_open_browser(uri);
 			g_free(uri);
-
 		}
 		else
 			build_run_cmd(doc, cmd);



--------------
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