summaryrefslogtreecommitdiff
path: root/buildstream/storage/_filebaseddirectory.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/storage/_filebaseddirectory.py')
-rw-r--r--buildstream/storage/_filebaseddirectory.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/buildstream/storage/_filebaseddirectory.py b/buildstream/storage/_filebaseddirectory.py
index dfb310ae1..67c0ec630 100644
--- a/buildstream/storage/_filebaseddirectory.py
+++ b/buildstream/storage/_filebaseddirectory.py
@@ -189,3 +189,19 @@ class FileBasedDirectory(Directory):
""" Returns the underlying (real) file system directory this
object refers to. """
return self.external_directory
+
+ def _get_filetype(self, name=None):
+ path = self.external_directory
+
+ if name:
+ path = os.path.join(path, name)
+
+ st = os.lstat(path)
+ if stat.S_ISDIR(st.st_mode):
+ return _FileType.DIRECTORY
+ elif stat.S_ISLNK(st.st_mode):
+ return _FileType.SYMLINK
+ elif stat.S_ISREG(st.st_mode):
+ return _FileType.REGULAR_FILE
+ else:
+ return _FileType.SPECIAL_FILE