Add program to find project diva mods

This commit is contained in:
Toast 2025-04-17 14:54:37 +02:00
parent d77aa542cf
commit ad3a8700d3
2 changed files with 37 additions and 1 deletions

View file

@ -1,4 +1,5 @@
add_executable(Hello helloWorld.cpp) add_executable(Hello helloWorld.cpp)
add_executable(tomlParse tomlParse.cpp) add_executable(tomlParse tomlParse.cpp)
add_executable(findDivaMods findDivaMods.cpp)
install(TARGETS Hello tomlParse DESTINATION bin) install(TARGETS Hello tomlParse findDivaMods DESTINATION bin)

35
src/findDivaMods.cpp Normal file
View file

@ -0,0 +1,35 @@
#include <filesystem>
#include <iostream>
#include <toml++/toml.hpp>
namespace fs = std::filesystem;
int main() {
auto originalPath{fs::current_path()};
fs::path modsPath{"/home/toast/.local/share/Steam/steamapps/common/Hatsune "
"Miku Project DIVA Mega Mix Plus/mods"};
fs::directory_iterator modsIterator{modsPath};
for (auto mod : modsIterator) {
if (!mod.is_directory()) {
std::cout
<< "Found file in mod folder, that's not supposed to be there!\n";
} else {
fs::current_path(mod.path());
fs::path configPath{"./config.toml"};
if (fs::exists(configPath)) {
toml::table config{toml::parse_file(configPath.string())};
auto version{config["version"]};
auto name{config["name"]};
std::cout << name << ": " << version << "\n";
}
}
}
fs::current_path(originalPath);
return 0;
}