From 1a8f351248c38445189a397035e8a2cb3182ea6a Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 27 Dec 2010 20:48:35 +0100 Subject: Added HTTPRequest and HTTPResponse classes. --- music.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'music.cpp') diff --git a/music.cpp b/music.cpp index 3f44bf5..5ff9ec9 100644 --- a/music.cpp +++ b/music.cpp @@ -1,6 +1,7 @@ #include "music.h" #include +#include namespace music { @@ -10,7 +11,11 @@ void init(const fs::path root) { root_directory = new MusicDirectory(root); } -MusicListing *find(const std::string path, MusicDirectory& root) { +MusicListing *find(std::string path, MusicDirectory& root) { + // remove trailing slash + if(boost::algorithm::ends_with(path, "/")) + path = path.substr(0, path.size()-1); + fs::path full_path = root_directory->path / path; if(root.path == full_path) return &root; @@ -29,7 +34,7 @@ MusicListing *find(const std::string path, MusicDirectory& root) { return NULL; } -MusicListing *find(const std::string path) { +MusicListing *find(std::string path) { return find(path, *root_directory); } -- cgit v1.2.3