summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-04-28 17:25:28 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-04-28 17:25:28 +0200
commit8e0002ac420707b94a8a43dfedea7fc182dd5851 (patch)
treeee125ad1dd03f56436fb733f13d4c36c1e3d2fa8 /apt-pkg/contrib/fileutl.cc
parenta9d990a2602fca4f217705e356b449b0f42a7760 (diff)
parent53ac87ac9c27af39df062516aab5dce880af107a (diff)
Merge branch 'feature/abspath' into feature/apt-install-deb
Conflicts: test/libapt/fileutl_test.cc
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index dc21d10eb..c7c60e00e 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 /*{{{*/
// ---------------------------------------------------------------------
/* */