Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/Utilities/
FiddeeRoot.rs

1//! `$HOME/.fiddee` - the user-scope dotfile root. Holds VS Code-style
2//! extensions (`~/.fiddee/extensions`), recently-opened workspaces
3//! (`~/.fiddee/workspaces/RecentlyOpened.json`), per-extension storage
4//! (`~/.fiddee/extensionStorage`, `~/.fiddee/globalStorage`), and the
5//! background-daemon log/data trees (`~/.fiddee/logs`, `~/.fiddee/data`).
6//!
7//! Renamed from `~/.land` when the product shipped as FIDDEE; centralised
8//! here so that any future rename touches a single file. All callers
9//! resolve their sub-paths from this atom rather than hard-coding the
10//! leaf string.
11
12use std::path::PathBuf;
13
14/// Leaf directory name. Public so TS-side callers that mirror this value
15/// (`Cocoon/Source/Services/Handler/Extension/Host/Handler.ts` etc.) can
16/// import the constant via a generated header if/when that wiring lands.
17pub const DOTFILE_NAME:&str = ".fiddee";
18
19/// Returns `$HOME/.fiddee` (or `$USERPROFILE\.fiddee` on Windows).
20/// Falls back to a relative `.fiddee` so callers always get a valid
21/// `PathBuf` - matches the previous `$HOME/.land` resolution semantics.
22pub fn Fn() -> PathBuf {
23	if let Some(Home) = dirs::home_dir() {
24		return Home.join(DOTFILE_NAME);
25	}
26
27	if let Ok(Home) = std::env::var("HOME").or_else(|_| std::env::var("USERPROFILE")) {
28		return PathBuf::from(Home).join(DOTFILE_NAME);
29	}
30
31	PathBuf::from(DOTFILE_NAME)
32}