[banshee] [gio] Fix library rescanning (bgo#611813)



commit daa74167885efb6ec10c81fa50ac94888782a622
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Mon Mar 15 12:54:54 2010 +1100

    [gio] Fix library rescanning (bgo#611813)
    
    GIO backend returns URIs, not file paths. We shoudn't call
    Path.Combine() on URIs, it makes them unusable by replacing
    'file:///' with 'file:/'
    
    As a result, library scanner couldn't find anything and deleted
    files from the library.

 .../Banshee.Gio/Banshee.IO.Gio/Directory.cs        |    4 ++--
 .../Banshee.IO/DirectoryScannerPipelineElement.cs  |    5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs b/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs
index 7c6a8fe..0f12bcd 100644
--- a/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs
+++ b/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs
@@ -119,7 +119,7 @@ namespace Banshee.IO.Gio
         {
             foreach (FileInfo file in dir.EnumerateChildren ("standard::type,standard::name", followSymlinks ? FileQueryInfoFlags.None : FileQueryInfoFlags.NofollowSymlinks, null)) {
                 if ((file.FileType & FileType.Regular) != 0) {
-                    yield return System.IO.Path.Combine (dir.Uri.AbsoluteUri, file.Name);
+                    yield return dir.Uri.AbsoluteUri + "/" + Uri.EscapeDataString (file.Name);
                 }
             }
         }
@@ -133,7 +133,7 @@ namespace Banshee.IO.Gio
         {
             foreach (FileInfo file in dir.EnumerateChildren ("standard::type,standard::name", followSymlinks ? FileQueryInfoFlags.None : FileQueryInfoFlags.NofollowSymlinks, null)) {
                 if ((file.FileType & FileType.Directory) != 0) {
-                    yield return System.IO.Path.Combine (dir.Uri.AbsoluteUri, file.Name);
+                    yield return dir.Uri.AbsoluteUri + "/" + Uri.EscapeDataString (file.Name);
                 }
             }
         }
diff --git a/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs b/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs
index 9147b46..094f88a 100644
--- a/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs
+++ b/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs
@@ -76,8 +76,6 @@ namespace Banshee.IO
                 }
             } else if (is_directory) {
                 try {
-                    // Normalise the path (remove the trailing directory separator)
-                    source = Path.Combine (Path.GetDirectoryName (source), Path.GetFileName (source));
                     if (!skip_hidden || !Path.GetFileName (source).StartsWith (".")) {
                         visited_dirs.Add (source);
                         try {
@@ -90,7 +88,8 @@ namespace Banshee.IO
                                     ScanForFiles (directory, true);
                                 }
                             }
-                        } catch {
+                        } catch (Exception e) {
+                            Hyena.Log.Exception (e);
                         }
                     }
                 } catch (System.ArgumentException) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]