When displaying paths on MS Windows, make them look normal

Change the forward slashes to back slashes as that is normal for paths
in MS Windows.
This commit is contained in:
Robert Fewell 2019-04-09 17:32:53 +01:00
parent e745f4cfee
commit d44e0ee750
3 changed files with 21 additions and 2 deletions

View File

@ -170,7 +170,12 @@ convert_uri_to_unescaped (AssocDialog *assoc_dialog, const gchar *uri, gchar *sc
file_path = convert_uri_to_filename (assoc_dialog, uri, scheme);
if (file_path)
{
uri_u = g_uri_unescape_string (file_path, NULL);
#ifdef G_OS_WIN32 // make path look like a traditional windows path
uri_u = g_strdelimit (uri_u, "/", '\\');
#endif
}
else
uri_u = g_uri_unescape_string (uri, NULL);
@ -489,7 +494,9 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
gchar *path_head_ue_str = g_uri_unescape_string (assoc_dialog->path_head, NULL);
gchar *path_head_str = gnc_uri_get_path (path_head_ue_str);
gchar *path_head_label;
#ifdef G_OS_WIN32 // make path look like a traditional windows path
path_head_str = g_strdelimit (path_head_str, "/", '\\');
#endif
// test for current folder being present
if (g_file_test (path_head_str, G_FILE_TEST_IS_DIR))
path_head_label = g_strconcat (_("Path head for files is, "), path_head_str, NULL);

View File

@ -1083,7 +1083,13 @@ gsr_default_associate_handler_file (GNCSplitReg *gsr, Transaction *trans, gboole
GtkWidget *label;
gchar *file_uri_u = g_uri_unescape_string (file_uri, NULL);
gchar *filename = gnc_uri_get_path (file_uri_u);
gchar *uri_label = g_strconcat (_("Existing Association is '"), filename, "'", NULL);
gchar *uri_label;
#ifdef G_OS_WIN32 // make path look like a traditional windows path
filename = g_strdelimit (filename, "/", '\\');
#endif
uri_label = g_strconcat (_("Existing Association is '"), filename, "'", NULL);
PINFO("Path head: '%s', URI: '%s', Filename: '%s'", path_head, uri, filename);
label = gtk_label_new (uri_label);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), label);

View File

@ -574,6 +574,11 @@ gnc_split_register_get_associate_tooltip (VirtualLocation virt_loc,
if (gnc_uri_is_file_scheme (scheme)) // absolute path
file_path = gnc_uri_get_path (uri);
#ifdef G_OS_WIN32 // make path look like a traditional windows path
if (file_path)
file_path = g_strdelimit (file_path, "/", '\\');
#endif
g_free (scheme);
if (!file_path)
@ -583,6 +588,7 @@ gnc_split_register_get_associate_tooltip (VirtualLocation virt_loc,
gchar *file_uri_u = g_uri_unescape_string (file_path, NULL);
const gchar *filename = gnc_uri_get_path (file_uri_u);
g_free (file_uri_u);
g_free (file_path);
return g_strdup (filename);
}
}