Many areas of code rely on the filesystem state not being changed between checks and actions.
One example is in copy:
e.g.
if !options.overwrite && to.as_ref().exists() {
if options.skip_exist {
return Ok(0);
}
if let Some(msg) = to.as_ref().to_str() {
let msg = format!("Path \"{}\" exists", msg);
err!(&msg, ErrorKind::AlreadyExists);
}
}
// If the destination is created at this point then it's silently overwritten.
Ok(std::fs::copy(from, to)?)
}
There are several examples is in copy_with_progress due to performing checks using the path rather than a descriptor.
Many areas of code rely on the filesystem state not being changed between checks and actions.
One example is in copy:
e.g.
There are several examples is in
copy_with_progressdue to performing checks using the path rather than a descriptor.