Find the user's Steam client, native or Flatpak.
More...
#include <algorithm>
#include <cctype>
#include <filesystem>
#include <fstream>
#include <optional>
#include <string>
#include <string_view>
#include <sys/types.h>
Go to the source code of this file.
Find the user's Steam client, native or Flatpak.
Definition in file desktop_steam.h.
◆ find()
| std::optional< client_t > platf::desktop_steam::find |
( |
const std::filesystem::path & | proc, |
|
|
uid_t | uid, |
|
|
const std::filesystem::path & | pid_file, |
|
|
std::string_view | own_cgroup ) |
|
inline |
The user's running Steam client.
~/.steam/steam.pid names the native client. A Flatpak's pid file is in its own home, ~/.var/app/com.valvesoftware.Steam, and holds the pid in the sandbox's pid namespace, which means nothing outside it; so this looks through /proc for the client instead.
- Parameters
-
| proc | The proc file system. |
| uid | The user whose Steam to find. |
| pid_file | The native pid file, tried first; empty to skip it. |
| own_cgroup | Hermes' own cgroup when it runs as a service; a Steam under it is one Hermes started, not the desktop's. |
Definition at line 86 of file desktop_steam.h.
◆ first_line()
| std::string platf::desktop_steam::detail::first_line |
( |
const std::filesystem::path & | file | ) |
|
|
inline |
◆ in_flatpak()
| bool platf::desktop_steam::detail::in_flatpak |
( |
const std::filesystem::path & | entry | ) |
|
|
inline |
◆ is_client()
| bool platf::desktop_steam::detail::is_client |
( |
const std::filesystem::path & | entry | ) |
|
|
inline |
The client is an executable named steam under the Steam directory: steamrt64/steam for the 64-bit client, ubuntu12_32/steam before it. The steam launcher is a shell script with the same process name, but its executable is the shell, so the executable's name tells them apart.
Definition at line 54 of file desktop_steam.h.
◆ owned_by()
| bool platf::desktop_steam::detail::owned_by |
( |
const std::filesystem::path & | entry, |
|
|
uid_t | uid ) |
|
inline |
◆ flatpak_id
| std::string_view platf::desktop_steam::flatpak_id = "com.valvesoftware.Steam" |
|
inlineconstexpr |