filter beatsaber maps by name
This commit is contained in:
parent
3bce6bdfd9
commit
9340eb92f4
|
@ -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<std::shared_ptr<BeatMap>> loadMapsfromInstallation(std::string gamePath = "");
|
||||
std::list<std::shared_ptr<BeatMap>> loadMapsfromInstallation(const std::string& filter = "", std::string gamePath = "");
|
||||
|
||||
}
|
|
@ -74,7 +74,7 @@ std::string findBeatsaberInstallation() {
|
|||
return ""; //not found
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<BeatMap>> loadMapsfromInstallation(std::string gamePath) {
|
||||
std::list<std::shared_ptr<BeatMap>> loadMapsfromInstallation(const std::string& filter, std::string gamePath) {
|
||||
if(gamePath.empty()) {
|
||||
gamePath = findBeatsaberInstallation();
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ std::list<std::shared_ptr<BeatMap>> 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());
|
||||
|
|
Loading…
Reference in New Issue