glib2/gio-2.18-always-pass-fuse-f...

76 lines
1.9 KiB
Diff

--- trunk/gio/gdesktopappinfo.c 2008/09/26 19:57:36 7554
+++ trunk/gio/gdesktopappinfo.c 2008/10/01 17:46:57 7566
@@ -530,9 +530,32 @@
{
GList *uris = *uri_list;
char *expanded;
-
+ gboolean force_file_uri;
+ char force_file_uri_macro;
+
g_return_if_fail (exec != NULL);
-
+
+ /* On %u and %U, pass POSIX file path pointing to the URI via
+ * the FUSE mount in ~/.gvfs. Note that if the FUSE daemon isn't
+ * running or the URI doesn't have a POSIX file path via FUSE
+ * we'll just pass the URI.
+ */
+ switch (macro)
+ {
+ case 'u':
+ force_file_uri_macro = 'f';
+ force_file_uri = TRUE;
+ break;
+ case 'U':
+ force_file_uri_macro = 'F';
+ force_file_uri = TRUE;
+ break;
+ default:
+ force_file_uri_macro = macro;
+ force_file_uri = FALSE;
+ break;
+ }
+
switch (macro)
{
case 'u':
@@ -541,7 +564,17 @@
case 'n':
if (uris)
{
- expanded = expand_macro_single (macro, uris->data);
+ if (!force_file_uri)
+ {
+ expanded = expand_macro_single (macro, uris->data);
+ }
+ else
+ {
+ expanded = expand_macro_single (force_file_uri_macro, uris->data);
+ if (expanded == NULL)
+ expanded = expand_macro_single (macro, uris->data);
+ }
+
if (expanded)
{
g_string_append (exec, expanded);
@@ -558,7 +591,17 @@
case 'N':
while (uris)
{
- expanded = expand_macro_single (macro, uris->data);
+ if (!force_file_uri)
+ {
+ expanded = expand_macro_single (macro, uris->data);
+ }
+ else
+ {
+ expanded = expand_macro_single (force_file_uri_macro, uris->data);
+ if (expanded == NULL)
+ expanded = expand_macro_single (macro, uris->data);
+ }
+
if (expanded)
{
g_string_append (exec, expanded);