diff options
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); } |