let rec mv ?(force=Force) fln_src fln_dst =
let fln_src_abs = make_absolute (pwd ()) fln_src
in
let fln_dst_abs = make_absolute (pwd ()) fln_dst
in
if compare fln_src_abs fln_dst_abs <> 0 then
(
if test Exists fln_dst_abs && doit force fln_dst then
(
rm [fln_dst_abs];
mv fln_src_abs fln_dst_abs
)
else if test Is_dir fln_dst_abs then
(
mv ~force
fln_src_abs
(make_absolute
fln_dst_abs
(basename fln_src_abs))
)
else if test Exists fln_src_abs then
(
try
Sys.rename fln_src_abs fln_dst_abs
with Sys_error _ ->
(
cp ~force ~recurse:true [fln_src_abs] fln_dst_abs;
rm ~force ~recurse:true [fln_src_abs]
)
)
else
(
raise MvNoSourceFile
)
)