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 {