Skip to content

Commit

Permalink
Use utils_get_uri_file_prefix() as file URI prefix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eht16 committed Oct 29, 2017
1 parent a1991c4 commit cb669e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cb669e2

Please sign in to comment.