aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/fs_path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/util/fs_path.cc')
-rw-r--r--paludis/util/fs_path.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/paludis/util/fs_path.cc b/paludis/util/fs_path.cc
index 3fd1eeb07..ff7b303fb 100644
--- a/paludis/util/fs_path.cc
+++ b/paludis/util/fs_path.cc
@@ -196,6 +196,17 @@ FSPath::strip_leading(const FSPath & f) const
return FSPath(_imp->path.substr(root.length()));
}
+bool
+FSPath::starts_with(const FSPath & f) const
+{
+ std::string root(stringify(f));
+
+ if (root == "/")
+ root.clear();
+ root.append("/");
+ return 0 == (_imp->path + "/").compare(0, root.length(), root);
+}
+
FSPath
FSPath::dirname() const
{