MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / find_only_subdir

Function find_only_subdir

tools/regen/src/csharp.rs:127–146  ·  view source on GitHub ↗
(dir: &Path)

Source from the content-addressed store, hash-verified

125}
126
127fn find_only_subdir(dir: &Path) -> Result<PathBuf> {
128 let mut subdirs = vec![];
129
130 for entry in fs::read_dir(dir)? {
131 let entry = entry?;
132 if entry.file_type()?.is_dir() {
133 subdirs.push(entry.path());
134 }
135 }
136
137 match subdirs.as_slice() {
138 [] => bail!("Could not find a restored versioned directory under {}", dir.display()),
139 [only] => Ok(only.clone()),
140 _ => bail!(
141 "Expected exactly one restored versioned directory under {}, found {}",
142 dir.display(),
143 subdirs.len()
144 ),
145 }
146}
147
148fn copy_overlay_dir(src: &Path, dst: &Path) -> Result<()> {
149 if !src.exists() {

Callers 1

Calls 4

OkFunction · 0.50
pushMethod · 0.45
pathMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…