diff options
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r-- | bpkg/utility.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index ec95264..d084b76 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -313,6 +313,30 @@ namespace bpkg return true; } + bool + mv (const path& from, const path& to, bool ie) + { + if (verb >= 3) + text << "mv " << from << ' ' << to; + + try + { + mvfile (from, to, + cpflags::overwrite_content | cpflags::overwrite_permissions); + } + catch (const system_error& e) + { + error << "unable to move file " << from << " to " << to << ": " << e; + + if (ie) + return false; + + throw failed (); + } + + return true; + } + dir_path change_wd (const dir_path& d) { |