[pitboss/grind] deferred session-0003 (20260517T044708Z-e058)

This commit is contained in:
pitboss 2026-05-17 01:18:54 -05:00
parent 6698eb96eb
commit 2544e5d9da
7 changed files with 257 additions and 10 deletions

View file

@ -208,9 +208,12 @@ pub fn profile_path(name: &str) -> Option<PathBuf> {
}
let dir = profile_dir()?;
let path = dir.join(format!("{key}.sb"));
if !path.exists() {
std::fs::write(&path, source).ok()?;
}
// Always overwrite on first miss in this process so an upgraded nyx
// binary picks up new profile content even when a previous version
// left a stale `.sb` file under `std::env::temp_dir()`. The in-process
// `PROFILE_PATHS` cache then short-circuits subsequent lookups so the
// write happens at most once per profile per process lifetime.
std::fs::write(&path, source).ok()?;
let mut cache = profile_paths().lock().ok()?;
cache.insert(*key, path.clone());
Some(path)