MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / FindGameInstallPath

Function FindGameInstallPath

src/common/local_storage.cpp:574–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572}
573
574static std::string FindGameInstallPath(const std::string& steamPath, uint32_t appId) {
575 for (const auto& libPath : GetSteamLibraryPaths(steamPath)) {
576 auto manifestPath = libPath / "steamapps" / ("appmanifest_" + std::to_string(appId) + ".acf");
577 std::ifstream mf(manifestPath);
578 if (!mf) continue;
579
580 std::string line;
581 while (std::getline(mf, line)) {
582 auto pos = line.find("\"installdir\"");
583 if (pos == std::string::npos) continue;
584 auto q1 = line.rfind('"');
585 auto q2 = q1 == std::string::npos ? std::string::npos : line.rfind('"', q1 - 1);
586 if (q1 != std::string::npos && q2 != std::string::npos && q1 > q2) {
587 auto installDir = line.substr(q2 + 1, q1 - q2 - 1);
588 return FileUtil::PathToUtf8(libPath / "steamapps" / "common" / FileUtil::Utf8ToPath(installDir));
589 }
590 }
591 }
592 return {};
593}
594
595bool IsAppInstalled(const std::string& steamPath, uint32_t appId) {
596 return AutoCloudScan::IsAppInstalled(steamPath, appId);

Callers

nothing calls this directly

Calls 4

findMethod · 0.80
GetSteamLibraryPathsFunction · 0.70
PathToUtf8Function · 0.70
Utf8ToPathFunction · 0.70

Tested by

no test coverage detected