MCPcopy Create free account
hub / github.com/clawshell/clawshell / next_backup_path

Function next_backup_path

src/migration/orchestrator.rs:203–217  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

201}
202
203pub(crate) fn next_backup_path(path: &Path) -> PathBuf {
204 let first = PathBuf::from(format!("{}.bak", path.display()));
205 if !first.exists() {
206 return first;
207 }
208
209 let mut idx = 1;
210 loop {
211 let candidate = PathBuf::from(format!("{}.bak.{}", path.display(), idx));
212 if !candidate.exists() {
213 return candidate;
214 }
215 idx += 1;
216 }
217}
218
219#[cfg(test)]
220mod tests {

Callers 2

migrate_targetsFunction · 0.85
test_next_backup_pathFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_next_backup_pathFunction · 0.68