diff options
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index b1231e45574f..dad5f624bd00 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -148,6 +148,15 @@ string baseNameOf(const Path & path) } +bool isInDir(const Path & path, const Path & dir) +{ + return path[0] == '/' + && string(path, 0, dir.size()) == dir + && path.size() >= dir.size() + 2 + && path[dir.size()] == '/'; +} + + struct stat lstat(const Path & path) { struct stat st; |