diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-12-27 20:48:35 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-12-27 20:48:35 +0100 |
commit | 1a8f351248c38445189a397035e8a2cb3182ea6a (patch) | |
tree | 507c96dc5fc1e158f799cdeb13cfab382a7a0534 /music.cpp | |
parent | 263097e22bdf0a56007644e4d19605371dc79a8f (diff) |
Added HTTPRequest and HTTPResponse classes.
Diffstat (limited to 'music.cpp')
-rw-r--r-- | music.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,6 +1,7 @@ #include "music.h" #include <boost/format.hpp> +#include <boost/algorithm/string/predicate.hpp> 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); } |