It would be very helpful if there was a variant of Eio.Path.unlink that doesn't require the file to exist.
One possibility would be an optional missing_ok argument, similar to what we have in rmtree, e.g.:
let unlink ?(missing_ok=false) path =
match missing_ok with
| false -> original_unlink path
| true ->
try original_unlink path
with Eio.Io (Eio.Fs.(E (Not_found _)), _) -> ()
The main difference to rmtree is that with this version one cannot accidentally delete whole directory sub trees.
Does that make sense? Would you accept a PR for that?
It would be very helpful if there was a variant of Eio.Path.unlink that doesn't require the file to exist.
One possibility would be an optional
missing_okargument, similar to what we have inrmtree, e.g.:The main difference to
rmtreeis that with this version one cannot accidentally delete whole directory sub trees.Does that make sense? Would you accept a PR for that?