diff src/audacious/playlist.c @ 3081:ba2143c1c6f5

unescape url encoded filename where real filename is needed.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Tue, 17 Jul 2007 00:31:43 +0900
parents 72766f2e8713
children 030b956c73b2
line wrap: on
line diff
--- a/src/audacious/playlist.c	Mon Jul 16 00:02:11 2007 +0200
+++ b/src/audacious/playlist.c	Tue Jul 17 00:31:43 2007 +0900
@@ -352,6 +352,7 @@
     return playlist->title;
 }
 
+/* filename is real filename here. --yaz */
 gboolean
 playlist_set_current_name(Playlist *playlist, const gchar * filename)
 {
@@ -1817,7 +1818,10 @@
     PLAYLIST_UNLOCK(playlist->mutex);
 
     if (!title) {
-        title = g_path_get_basename(entry->filename);
+        gchar *realfn = NULL;
+        realfn = g_filename_from_uri(entry->filename, NULL, NULL);
+        title = g_path_get_basename(realfn ? realfn : entry->filename);
+        g_free(realfn); realfn = NULL;
         return str_replace(title, filename_to_utf8(title));
     }
 
@@ -2069,8 +2073,12 @@
 {
     struct stat buf;
     gint rv;
-
-    rv = stat(filename, &buf);
+    gchar *realfn = NULL;
+
+    /* stat() does not accept file:// --yaz */
+    realfn = g_filename_from_uri(filename, NULL, NULL);
+    rv = stat(realfn ? realfn : filename, &buf);
+    g_free(realfn); realfn = NULL;
 
     if (rv == 0) {
         return buf.st_mtime;