Initial Agentsd project commit
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
12
core/agentsd/src/paths.rs
Normal file
12
core/agentsd/src/paths.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Returns the `data/` directory next to the running executable.
|
||||
/// Creates it if it does not exist.
|
||||
pub fn data_dir() -> PathBuf {
|
||||
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("."));
|
||||
let dir = exe.parent().unwrap_or_else(|| std::path::Path::new(".")).join("data");
|
||||
if !dir.exists() {
|
||||
std::fs::create_dir_all(&dir).ok();
|
||||
}
|
||||
dir
|
||||
}
|
||||
Reference in New Issue
Block a user