record-daemon: give scripted runs a home of their own

An end-to-end run of mine put its settings through updateSettings, which
wrote them to the user's real config: output path in %TEMP%, a "probe"
application, 30 fps. The next game recorded into %TEMP%, so it showed up
in the history with its metadata and no video beside it.

RECORD_DAEMON_HOME now moves the config directory, the recordings, the
logs and the IPC pipe under one directory. The app reads the same
variable, so a probe talks to the scratch daemon instead of the real one.
Default paths are unchanged.

The daemon also logs its config and recordings paths at startup, which is
the first thing to look at when a recording has no video.
This commit is contained in:
vhaudiquet committed 2026-11-17 00:19:13 +01:00
1 parent 6584b2f92f
commit 2e463dab3a
6 files changed
+71 -8

No files matched your search

+11 -2
View File
@@ -69,16 +69,25 @@ pub struct IpcResponse {
pub error: Option<String>,
}
/// The pipe the daemon listens on.
/// The pipe the daemon listens on. A scratch home, as scripts set, gets a pipe of its own.
pub fn default_socket_path() -> PathBuf {
let scratch = std::env::var_os(crate::daemon::HOME_ENV).is_some_and(|value| !value.is_empty());
#[cfg(windows)]
{
if scratch {
return PathBuf::from(r"\\.\pipe\record-daemon-scratch");
}
PathBuf::from(r"\\.\pipe\record-daemon")
}
#[cfg(not(windows))]
{
let name = if scratch {
"record-daemon-scratch.sock"
} else {
"record-daemon.sock"
};
let dir = std::env::var("XDG_RUNTIME_DIR").unwrap_or_else(|_| "/tmp".into());
Path::new(&dir).join("record-daemon.sock")
Path::new(&dir).join(name)
}
}