From 2526dc688c044b0bc871c7d118daa882b8665a47 Mon Sep 17 00:00:00 2001 From: damocles Date: Sat, 16 May 2026 04:35:19 +0200 Subject: [PATCH] paths: flat state layout when DAMOCLES_WORKSPACE is set --- src/paths.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/paths.rs b/src/paths.rs index d6a2dfa..bb27d5a 100644 --- a/src/paths.rs +++ b/src/paths.rs @@ -15,8 +15,16 @@ pub fn workspace_dir() -> PathBuf { } } +/// Runtime state dir. When `DAMOCLES_WORKSPACE` is set (hyperhive flat +/// layout) the state files live directly in the workspace — no `state/` +/// subdirectory. In the legacy `/workspace` layout they live in +/// `/state/`. pub fn state_dir() -> PathBuf { - workspace_dir().join("state") + if std::env::var("DAMOCLES_WORKSPACE").is_ok() { + workspace_dir() + } else { + workspace_dir().join("state") + } } pub fn identity_dir() -> PathBuf {