[banshee/stable-1.8] Playlists: Fix parsing when started from root directory (bgo#486543)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/stable-1.8] Playlists: Fix parsing when started from root directory (bgo#486543)
- Date: Sat, 22 Jan 2011 15:03:17 +0000 (UTC)
commit 413e5421b7ec626d6ab37b69da809d1689111306
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sat Jan 22 15:58:18 2011 +0100
Playlists: Fix parsing when started from root directory (bgo#486543)
Playlist parsers use the current directory as a default base directory.
This would fail when banshee is started from the root directory, as
System.Uri rejects "/" as a value.
We now handle "/" as a special case, setting the base URI to "file:///".
.../PlaylistFormatBase.cs | 10 +++++++++-
.../Banshee.Playlists.Formats/PlaylistParser.cs | 8 +++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
index fc0ebb1..64b3c3d 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
@@ -41,13 +41,21 @@ namespace Banshee.Playlists.Formats
{
private Dictionary<string, object> attributes = new Dictionary<string, object>();
private List<Dictionary<string, object>> elements = new List<Dictionary<string, object>>();
- private Uri base_uri = new Uri(Environment.CurrentDirectory);
+ private Uri base_uri = null;
private string title = null;
public PlaylistFormatBase()
{
attributes = new Dictionary<string, object>();
elements = new List<Dictionary<string, object>>();
+
+ if (Environment.CurrentDirectory.Equals ("/")) {
+ // System.Uri doesn't like / as a value
+ base_uri = new Uri ("file:///");
+ } else {
+ base_uri = new Uri (Environment.CurrentDirectory);
+ }
+
}
public virtual void Load(Stream stream, bool validateHeader)
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
index b081c79..9569ed5 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
@@ -50,11 +50,17 @@ namespace Banshee.Playlists.Formats
};
private List<Dictionary<string, object>> elements;
- private Uri base_uri = new Uri (Environment.CurrentDirectory);
+ private Uri base_uri = null;
private string title = null;
public PlaylistParser ()
{
+ if (Environment.CurrentDirectory.Equals ("/")) {
+ // System.Uri doesn't like / as a value
+ base_uri = new Uri ("file:///");
+ } else {
+ base_uri = new Uri (Environment.CurrentDirectory);
+ }
}
public bool Parse (SafeUri uri)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]