diff --git a/include/beatsaber/beatsaber.h b/include/beatsaber/beatsaber.h index 50960e0..29dd63f 100644 --- a/include/beatsaber/beatsaber.h +++ b/include/beatsaber/beatsaber.h @@ -12,6 +12,6 @@ std::string findBeatsaberInstallation(); // when gamepath is empty, findBeatsaberInstallation is used to get a Path // from the installation folder as many mas as possible are loaded -std::list> loadMapsfromInstallation(std::string gamePath = ""); +std::list> loadMapsfromInstallation(const std::string& filter = "", std::string gamePath = ""); } \ No newline at end of file diff --git a/src/beatsaber.cpp b/src/beatsaber.cpp index 19044ef..f28c937 100644 --- a/src/beatsaber.cpp +++ b/src/beatsaber.cpp @@ -74,7 +74,7 @@ std::string findBeatsaberInstallation() { return ""; //not found } -std::list> loadMapsfromInstallation(std::string gamePath) { +std::list> loadMapsfromInstallation(const std::string& filter, std::string gamePath) { if(gamePath.empty()) { gamePath = findBeatsaberInstallation(); } @@ -85,6 +85,10 @@ std::list> loadMapsfromInstallation(std::string gamePat for(const auto& i : std::filesystem::directory_iterator(path / "Beat Saber_Data/CustomLevels")) { if(i.exists()) { + + std::string name = i.path().filename(); + if(name.find(filter) == std::string::npos) continue; + if(i.is_directory()) { //try to load auto map = BeatMap::loadFromFolder(i.path().string());