mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 747795 - Attached file not found.
MSWin only. ShellExecuteW("open") doesn't decode http escapes on file: IRIs.
This commit is contained in:
parent
211b923cd7
commit
2137cb6d38
@ -430,19 +430,31 @@ gnc_launch_assoc (const char *uri)
|
|||||||
void
|
void
|
||||||
gnc_launch_assoc (const char *uri)
|
gnc_launch_assoc (const char *uri)
|
||||||
{
|
{
|
||||||
wchar_t *winuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL);
|
wchar_t *winuri = NULL;
|
||||||
wchar_t *wincmd = (wchar_t *)g_utf8_to_utf16("open", -1, NULL, NULL, NULL);
|
/* ShellExecuteW open doesn't decode http escapes if it's passed a
|
||||||
|
* file URI so we have to do it. */
|
||||||
|
if (strcmp (g_uri_parse_scheme(uri), "file") == 0)
|
||||||
|
{
|
||||||
|
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
||||||
|
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
winuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (winuri)
|
if (winuri)
|
||||||
{
|
{
|
||||||
if ((INT_PTR)ShellExecuteW(NULL, wincmd, winuri, NULL, NULL, SW_SHOWNORMAL) <= 32)
|
wchar_t *wincmd = (wchar_t *)g_utf8_to_utf16("open", -1,
|
||||||
{
|
NULL, NULL, NULL);
|
||||||
const gchar *message =
|
if ((INT_PTR)ShellExecuteW(NULL, wincmd, winuri,
|
||||||
_("GnuCash could not find the associated file.");
|
NULL, NULL, SW_SHOWNORMAL) <= 32)
|
||||||
gnc_error_dialog(NULL, "%s", message);
|
{
|
||||||
}
|
const gchar *message =
|
||||||
g_free (winuri);
|
_("GnuCash could not find the associated file");
|
||||||
|
gnc_error_dialog(NULL, "%s: %s", message, uri);
|
||||||
|
}
|
||||||
|
g_free (wincmd);
|
||||||
|
g_free (winuri);
|
||||||
}
|
}
|
||||||
g_free (wincmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user