MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / ensure_dir_exists

Function ensure_dir_exists

desktop/src/dirs.rs:7–11  ·  view source on GitHub ↗
(path: &PathBuf)

Source from the content-addressed store, hash-verified

5
6pub(crate) fn ensure_dir_exists(path: &PathBuf) {
7 if !path.exists() {
8 fs::create_dir_all(path).unwrap_or_else(|_| panic!("Failed to create directory at {path:?}"));
9 }
10}
11
12pub(crate) fn clear_dir(path: &PathBuf) {
13 let Ok(entries) = fs::read_dir(path) else {
14 tracing::error!("Failed to read directory at {path:?}");

Callers 4

app_data_dirFunction · 0.85
app_tmp_dirFunction · 0.85
app_resources_dirFunction · 0.85

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected