diff options
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 50019872e..f65f7cf28 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -275,7 +275,22 @@ bool CreateDirectory(string const &Parent, string const &Path) } return true; } - /*}}}*/ + +// Rename - Rename a file /*{{{*/ +// --------------------------------------------------------------------- +/* This helper function is used by alot of item methods as thier final + step */ +bool Rename(string From, string To) +{ + if (rename(From.c_str(),To.c_str()) != 0) + { + return _error->Error("Rename failed. %s (%s -> %s).",strerror(errno), + From.c_str(),To.c_str()); + } + return true; +} + +/*}}}*/ // CreateAPTDirectoryIfNeeded - ensure that the given directory exists /*{{{*/ // --------------------------------------------------------------------- /* a small wrapper around CreateDirectory to check if it exists and to |