MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / delete_file

Method delete_file

atomic-cli/src/commands/remove.rs:214–223  ·  view source on GitHub ↗

Delete a file from the filesystem.

(&self, repo_root: &std::path::Path, path: &str)

Source from the content-addressed store, hash-verified

212
213 /// Delete a file from the filesystem.
214 fn delete_file(&self, repo_root: &std::path::Path, path: &str) -> std::io::Result<()> {
215 let full_path = repo_root.join(path);
216 if full_path.is_dir() {
217 std::fs::remove_dir_all(&full_path)
218 } else if full_path.exists() {
219 std::fs::remove_file(&full_path)
220 } else {
221 Ok(()) // Already doesn't exist
222 }
223 }
224
225 /// Whether an untracked staged path should also leave the working copy.
226 ///

Callers 1

runMethod · 0.45

Calls 2

is_dirMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected