changeset 3303:eaf68ed98166 trunk

Use real filenames inside tuples not URIs
author Christian Birchinger <joker@netswarm.net>
date Fri, 10 Aug 2007 14:48:13 +0200
parents 1588a64f0204
children 00286cde2485
files src/audacious/tuple.c
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/tuple.c	Fri Aug 10 14:39:53 2007 +0200
+++ b/src/audacious/tuple.c	Fri Aug 10 14:48:13 2007 +0200
@@ -86,7 +86,7 @@
 Tuple *
 tuple_new_from_filename(gchar *filename)
 {
-    gchar *scratch, *ext;
+    gchar *scratch, *ext, *realfn;
     Tuple *tuple;
 
     g_return_val_if_fail(filename != NULL, NULL);
@@ -94,21 +94,25 @@
     tuple = tuple_new();
     
     g_return_val_if_fail(tuple != NULL, NULL);
-        
-    scratch = g_path_get_basename(filename);
+
+    realfn = g_filename_from_uri(filename, NULL, NULL);
+
+    scratch = g_path_get_basename(realfn ? realfn : filename);
     tuple_associate_string(tuple, "file-name", scratch);
     g_free(scratch);
 
-    scratch = g_path_get_dirname(filename);
+    scratch = g_path_get_dirname(realfn ? realfn : filename);
     tuple_associate_string(tuple, "file-path", scratch);
     g_free(scratch);
-    
+
+    g_free(realfn); realfn = NULL;
+
     ext = strrchr(filename, '.');
     if (ext != NULL) {
         ++ext;
         tuple_associate_string(tuple, "file-ext", scratch);
     }
-    
+
     return tuple;
 }