diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bd6a6c..74f7ff1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ add_executable(Hello helloWorld.cpp) add_executable(tomlParse tomlParse.cpp) +add_executable(findDivaMods findDivaMods.cpp) -install(TARGETS Hello tomlParse DESTINATION bin) +install(TARGETS Hello tomlParse findDivaMods DESTINATION bin) diff --git a/src/findDivaMods.cpp b/src/findDivaMods.cpp new file mode 100644 index 0000000..69681be --- /dev/null +++ b/src/findDivaMods.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + +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; +}