MCPcopy Create free account
hub / github.com/douglance/devsql / create_backup_path

Function create_backup_path

crates/ccql/src/sql/safety.rs:224–239  ·  view source on GitHub ↗

Create a backup path for a file

(original: &Path)

Source from the content-addressed store, hash-verified

222
223/// Create a backup path for a file
224fn create_backup_path(original: &Path) -> PathBuf {
225 let mut backup = original.to_path_buf();
226 let extension = backup
227 .extension()
228 .map(|e| e.to_string_lossy().to_string())
229 .unwrap_or_default();
230
231 let new_extension = if extension.is_empty() {
232 "bak".to_string()
233 } else {
234 format!("{}.bak", extension)
235 };
236
237 backup.set_extension(new_extension);
238 backup
239}
240
241#[cfg(test)]
242mod tests {

Callers 3

backup_tableMethod · 0.85
restore_from_backupMethod · 0.85
test_create_backup_pathFunction · 0.85

Calls 1

is_emptyMethod · 0.80

Tested by 1

test_create_backup_pathFunction · 0.68