Bug 797175 - Gnucash will not open from UNC paths.

UNC paths were overlooked in a change I made, corrected and added some
notes to source file for reminder.
This commit is contained in:
Robert Fewell 2019-04-12 11:46:59 +01:00
parent c091197f57
commit 0f6465ca6d

View File

@ -323,7 +323,22 @@ gchar *gnc_uri_create_uri (const gchar *scheme,
else
uri_scheme = g_strdup (scheme);
if (g_str_has_prefix (abs_path, "/"))
/* Arrive here with...
*
* /my/path/to/file with space.txt
* becomes file:///my/path/to/file with space.txt
*
* c:\my\path\to\file with space.txt
* becomes file:///c:\my\path\to\file with space.txt
*
* \\myserver\share\path\to\file with space.txt
* becomes file://\\myserver\share\path\to\file with space.txt
*
* probably they should all be forward slashs and spaces escaped
* also with UNC it could be file://myserver/share/path/to/file with space.txt
*/
if (g_str_has_prefix (abs_path, "/") || g_str_has_prefix (abs_path, "\\"))
uri = g_strdup_printf ( "%s://%s", uri_scheme, abs_path );
else // for windows add an extra "/"
uri = g_strdup_printf ( "%s:///%s", uri_scheme, abs_path );