MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / collectGamePaths

Function collectGamePaths

android/src/rpcsx-android.cpp:707–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707static void collectGamePaths(std::vector<std::string> &paths,
708 const std::string &rootDir) {
709 std::error_code ec;
710 std::vector<std::filesystem::path> workList;
711 workList.reserve(32);
712 if (!std::filesystem::is_directory(rootDir)) {
713 auto rootPath = std::filesystem::path(rootDir).parent_path();
714 if (rootPath.filename() == "USRDIR") {
715 rootPath = rootPath.parent_path();
716 }
717 if (rootPath.filename() == "PS3_GAME") {
718 rootPath = rootPath.parent_path();
719 }
720
721 workList.push_back(rootPath);
722 } else {
723 workList.push_back(rootDir);
724 }
725
726 while (!workList.empty()) {
727 auto dir = std::move(workList.back());
728 workList.pop_back();
729
730 for (auto &entry : std::filesystem::directory_iterator(dir, ec)) {
731 if (entry.is_directory()) {
732 if (entry.path().filename() != "C00") {
733 workList.push_back(entry.path());
734 }
735
736 continue;
737 }
738
739 if (entry.is_regular_file() && entry.path().filename() == "PARAM.SFO") {
740 paths.push_back(entry.path().parent_path().string());
741 continue;
742 }
743 }
744 }
745}
746
747static std::string locateEbootPath(std::string_view root) {
748 if (std::filesystem::is_regular_file(root)) {

Callers 1

collectGameInfoFunction · 0.85

Calls 6

push_backMethod · 0.80
pop_backMethod · 0.80
pathMethod · 0.80
stringMethod · 0.80
reserveMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected