home-dir-layout修正
This commit is contained in:
+18
-4
@@ -95,10 +95,24 @@ async fn main() -> ExitCode {
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize persistent store
|
||||
let store_dir = cli.store.clone().unwrap_or_else(|| {
|
||||
paths::sessions_dir().unwrap_or_else(|| PathBuf::from(".insomnia/sessions"))
|
||||
});
|
||||
// Initialize persistent store. `paths::sessions_dir()` only
|
||||
// returns None when none of INSOMNIA_HOME / INSOMNIA_DATA_DIR /
|
||||
// HOME is set — surface that as a hard error to match the
|
||||
// runtime-dir resolution below, rather than silently writing to a
|
||||
// relative path under cwd.
|
||||
let store_dir = match cli.store.clone() {
|
||||
Some(p) => p,
|
||||
None => match paths::sessions_dir() {
|
||||
Some(d) => d,
|
||||
None => {
|
||||
eprintln!(
|
||||
"error: could not resolve sessions directory \
|
||||
(set --store, INSOMNIA_HOME, INSOMNIA_DATA_DIR, or HOME)"
|
||||
);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
},
|
||||
};
|
||||
let store = match FsStore::new(&store_dir).await {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
//!
|
||||
//! Three prefixes address three physical libraries:
|
||||
//!
|
||||
//! | prefix | location |
|
||||
//! |--------------|----------------------------------------------------|
|
||||
//! | `$insomnia` | builtin, baked into the binary via `include_dir!` |
|
||||
//! | `$user` | `$XDG_CONFIG_HOME/insomnia/prompts/` (or similar) |
|
||||
//! | `$workspace` | `<project>/.insomnia/prompts/` |
|
||||
//! | prefix | location |
|
||||
//! |--------------|---------------------------------------------------------|
|
||||
//! | `$insomnia` | builtin, baked into the binary via `include_dir!` |
|
||||
//! | `$user` | `<config_dir>/prompts/` (resolved by `manifest::paths`) |
|
||||
//! | `$workspace` | `<project>/.insomnia/prompts/` |
|
||||
//!
|
||||
//! A reference is `$<prefix>/<path>` where `<path>` is a `/`-separated
|
||||
//! name without the `.md` extension (e.g. `$insomnia/common/header`).
|
||||
|
||||
@@ -95,7 +95,9 @@ impl RuntimeDir {
|
||||
&self.path
|
||||
}
|
||||
|
||||
/// Path where the Unix socket should be created.
|
||||
/// Path where the Unix socket should be created. External callers
|
||||
/// that only know the pod name (e.g. the TUI's attach flow)
|
||||
/// predict the same path via [`manifest::paths::pod_socket_path`].
|
||||
pub fn socket_path(&self) -> PathBuf {
|
||||
self.path.join("sock")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user