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

Function LoadNamespaceAppsFrom

src/platform/linux/cloud_intercept.cpp:47–77  ·  view source on GitHub ↗

Returns true and sets outPath if the file was read and DisableCloud == false. Adds any newly-seen appIds to g_namespaceApps. Existing entries are never removed.

Source from the content-addressed store, hash-verified

45// Returns true and sets outPath if the file was read and DisableCloud == false.
46// Adds any newly-seen appIds to g_namespaceApps. Existing entries are never removed.
47static bool LoadNamespaceAppsFrom(const std::string& configPath, int* outAdded) {
48 auto yaml = ParseYamlFile(configPath);
49 if (yaml.empty()) return false;
50
51 auto dcIt = yaml.find("DisableCloud");
52 if (dcIt == yaml.end() || !dcIt->second.isBool || dcIt->second.boolVal) {
53 LOG("[Linux] DisableCloud enabled/missing - cloud saves blocked by SLSsteam");
54 return false;
55 }
56
57 auto appsIt = yaml.find("AdditionalApps");
58 if (appsIt == yaml.end() || !appsIt->second.isList || appsIt->second.list.empty()) {
59 return true;
60 }
61
62 int added = 0;
63 {
64 std::lock_guard<std::mutex> lock(g_nsMutex);
65 for (const auto& appStr : appsIt->second.list) {
66 char* endp = nullptr;
67 unsigned long val = strtoul(appStr.c_str(), &endp, 10);
68 if (endp != appStr.c_str() && val > 0 && val <= 0xFFFFFFFF) {
69 if (g_namespaceApps.insert((uint32_t)val).second) {
70 ++added;
71 }
72 }
73 }
74 }
75 if (outAdded) *outAdded = added;
76 return true;
77}
78
79static std::string LoadNamespaceAppsFromSLSsteam() {
80 std::string home = GetHome();

Callers 2

WatchSLSsteamConfigFunction · 0.85

Calls 2

ParseYamlFileFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected