diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-04-28 17:24:35 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-04-28 17:24:35 +0200 |
commit | 53ac87ac9c27af39df062516aab5dce880af107a (patch) | |
tree | 6074a64724348e9c19faaef983d646ad028b57ac /apt-pkg/contrib/fileutl.cc | |
parent | a298a1dc595c548e6c10b48b8e69d987e5be1c42 (diff) |
add flAbsPath() as a wrapper to realpath()
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index de73a7fd8..abc0a5fb2 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -659,6 +659,22 @@ string flCombine(string Dir,string File) return Dir + '/' + File; } /*}}}*/ +// flAbsPath - Return the absolute path of the filename /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string flAbsPath(string File) +{ + char *p = realpath(File.c_str(), NULL); + if (p == NULL) + { + _error->Errno("realpath", "flAbsPath failed"); + return ""; + } + std::string AbsPath(p); + free(p); + return AbsPath; +} + /*}}}*/ // SetCloseExec - Set the close on exec flag /*{{{*/ // --------------------------------------------------------------------- /* */ |