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

Function WatchSLSsteamConfig

src/platform/linux/cloud_intercept.cpp:104–135  ·  view source on GitHub ↗

Watch SLSsteam config for changes; re-read AdditionalApps on modify.

Source from the content-addressed store, hash-verified

102
103// Watch SLSsteam config for changes; re-read AdditionalApps on modify.
104static void WatchSLSsteamConfig(std::string configPath) {
105 int notifyFd = inotify_init();
106 if (notifyFd == -1) {
107 LOG("[Linux] inotify_init failed: %s", strerror(errno));
108 return;
109 }
110 int wd = inotify_add_watch(notifyFd, configPath.c_str(), IN_MODIFY);
111 if (wd == -1) {
112 LOG("[Linux] inotify_add_watch %s failed: %s", configPath.c_str(), strerror(errno));
113 close(notifyFd);
114 return;
115 }
116 g_watcherFd.store(notifyFd, std::memory_order_release);
117 LOG("[Linux] Watching SLSsteam config for changes: %s", configPath.c_str());
118
119 for (;;) {
120 inotify_event event{};
121 ssize_t n = read(notifyFd, &event, sizeof(event));
122 if (n <= 0) {
123 if (n == -1 && errno == EINTR) continue;
124 break;
125 }
126 int added = 0;
127 if (LoadNamespaceAppsFrom(configPath, &added) && added > 0) {
128 LOG("[Linux] SLSsteam config change: registered %d new namespace app(s)", added);
129 }
130 }
131
132 inotify_rm_watch(notifyFd, wd);
133 close(notifyFd);
134 g_watcherFd.store(-1, std::memory_order_release);
135}
136
137// ── Parse loginusers.vdf for account ID ─────────────────────────────────
138//

Callers

nothing calls this directly

Calls 1

LoadNamespaceAppsFromFunction · 0.85

Tested by

no test coverage detected