aboutsummaryrefslogtreecommitdiff
path: root/bpkg/utility.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-08-01 21:06:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-08-04 13:01:50 +0300
commitd0e478348ab1362e22e426b2b3dbb3becf2d6a24 (patch)
tree8704d4ce6e12ca5103db492cb20dfd08a0853858 /bpkg/utility.cxx
parent67d42b48930f65a7e270e153f1ca627c5241d17b (diff)
Fix pkg-fetch which failed to re-fetch same package version in --replace mode
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r--bpkg/utility.cxx24
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)
{