15 lines
375 B
Rust
15 lines
375 B
Rust
|
|
// Shared utilities
|
||
|
|
|
||
|
|
use crate::store;
|
||
|
|
|
||
|
|
use std::fs;
|
||
|
|
use std::path::PathBuf;
|
||
|
|
|
||
|
|
/// Ensure a subdirectory of the memory dir exists and return its path.
|
||
|
|
pub(crate) fn memory_subdir(name: &str) -> Result<PathBuf, String> {
|
||
|
|
let dir = store::memory_dir().join(name);
|
||
|
|
fs::create_dir_all(&dir)
|
||
|
|
.map_err(|e| format!("create {}: {}", dir.display(), e))?;
|
||
|
|
Ok(dir)
|
||
|
|
}
|