summaryrefslogtreecommitdiff
path: root/music.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'music.cpp')
-rw-r--r--music.cpp9
1 files changed, 7 insertions, 2 deletions
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 <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);
}