Kaydet (Commit) cb669e2a authored tarafından Enrico Tröger's avatar Enrico Tröger

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.
üst a1991c4d
...@@ -1237,13 +1237,14 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data) ...@@ -1237,13 +1237,14 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data)
bc = get_build_cmd(doc, grp, cmd, NULL); bc = get_build_cmd(doc, grp, cmd, NULL);
if (bc != NULL && strcmp(bc->command, "builtin") == 0) if (bc != NULL && strcmp(bc->command, "builtin") == 0)
{ {
const gchar *uri_file_prefix;
gchar *uri; gchar *uri;
if (doc == NULL) if (doc == NULL)
return; 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); utils_open_browser(uri);
g_free(uri); g_free(uri);
} }
else else
build_run_cmd(doc, cmd); build_run_cmd(doc, cmd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment