a2d195f
diff -uNr audacious-1.1.0-dr2-orig/audacious/main.c audacious-1.1.0-dr2/audacious/main.c
a2d195f
--- audacious-1.1.0-dr2-orig/audacious/main.c	2006-06-11 06:29:02.000000000 +0200
a2d195f
+++ audacious-1.1.0-dr2/audacious/main.c	2006-07-09 16:35:43.000000000 +0200
a2d195f
@@ -47,6 +47,10 @@
a2d195f
 #include <X11/Xlib.h>
a2d195f
 #include <X11/Xatom.h>
a2d195f
 
a2d195f
+#ifdef HAVE_GNOME_VFS
a2d195f
+#include <libgnomevfs/gnome-vfs.h>
a2d195f
+#endif
a2d195f
+
a2d195f
 #include "libaudacious/configdb.h"
a2d195f
 #include "libaudacious/beepctrl.h"
a2d195f
 #include "libaudacious/util.h"
a2d195f
@@ -727,6 +731,47 @@
a2d195f
     exit(EXIT_SUCCESS);
a2d195f
 }
a2d195f
 
a2d195f
+static gchar*
a2d195f
+quote_filename(gchar* filename) {
a2d195f
+
a2d195f
+    /*
a2d195f
+     * Quote a filename for usage with gnome vfs.
a2d195f
+     * Since we get the filenames from the command line, we can
a2d195f
+     * not determine if they are already quoted or not.
a2d195f
+     *
a2d195f
+     * The algorithm employed here is as follows:
a2d195f
+     * - If the filename contains "://", it is treated as an URI
a2d195f
+     * - If the filename is an URI and contains "%" it is considered quoted.
a2d195f
+     * - If the filenname is not an URI, or an unquoted URI, it is quoted.
a2d195f
+     *
a2d195f
+     * This function does nothing if gnome VFS is not used.
a2d195f
+     */
a2d195f
+
a2d195f
+#ifdef HAVE_GNOME_VFS
a2d195f
+    gchar* quoted_filename;
a2d195f
+    char quote = 0;
a2d195f
+
a2d195f
+    if (strstr(filename, "://")) {
a2d195f
+        if (!strstr(filename, "%")) {
a2d195f
+            quote = 1;
a2d195f
+        }
a2d195f
+    } else {
a2d195f
+        quote = 1;
a2d195f
+    }
a2d195f
+
a2d195f
+    if (quote) {
a2d195f
+        gnome_vfs_init();
a2d195f
+        quoted_filename = gnome_vfs_escape_path_string(filename);
a2d195f
+        free(filename);
a2d195f
+        return quoted_filename;
a2d195f
+    } else {
a2d195f
+        return filename;
a2d195f
+    }
a2d195f
+#else
a2d195f
+    return filename;
a2d195f
+#endif
a2d195f
+}
a2d195f
+
a2d195f
 static void
a2d195f
 parse_cmd_line(gint argc,
a2d195f
                gchar ** argv,
a2d195f
@@ -820,6 +865,8 @@
a2d195f
         else
a2d195f
             filename = g_build_filename(current_dir, argv[i], NULL);
a2d195f
 
a2d195f
+        filename = quote_filename(filename);
a2d195f
+
a2d195f
         options->filenames = g_list_prepend(options->filenames, filename);
a2d195f
     }
a2d195f
 
2011ced
diff -uNr audacious-1.1.0-dr2-orig/audacious/Makefile audacious-1.1.0-dr2/audacious/Makefile
2011ced
--- audacious-1.1.0-dr2-orig/audacious/Makefile	2006-05-28 17:27:54.000000000 +0200
2011ced
+++ audacious-1.1.0-dr2/audacious/Makefile	2006-07-09 16:53:21.000000000 +0200
a2d195f
@@ -18,6 +18,7 @@
a2d195f
 CFLAGS += \
a2d195f
 	$(GTK_CFLAGS)      \
a2d195f
 	$(LIBGLADE_CFLAGS) \
a2d195f
+	$(GNOMEVFS_CFLAGS) \
a2d195f
 	$(BEEP_DEFINES)    \
a2d195f
 	$(ARCH_DEFINES)    \
a2d195f
 	-I..    \
a2d195f
diff -uNr audacious-1.1.0-dr2-orig/libaudacious/vfs_gnome.c audacious-1.1.0-dr2/libaudacious/vfs_gnome.c
a2d195f
--- audacious-1.1.0-dr2-orig/libaudacious/vfs_gnome.c	2006-03-12 06:06:47.000000000 +0100
a2d195f
+++ audacious-1.1.0-dr2/libaudacious/vfs_gnome.c	2006-07-09 18:01:35.000000000 +0200
a2d195f
@@ -56,7 +56,7 @@
a2d195f
     file->eof = FALSE;
a2d195f
 
a2d195f
     mode_to_gnome_vfs(mode, &g_mode, &truncate, &append);
a2d195f
-    gchar *escaped_file = gnome_vfs_escape_path_string(path);
a2d195f
+    gchar *escaped_file = g_strdup(path);
a2d195f
 
a2d195f
     if (!truncate) {
a2d195f
         g_result = gnome_vfs_open(&(file->handle), escaped_file, g_mode);