def __init__(self, fs, inode): ''' Constructor @raise IsADirectoryError: @raise ParentDirectoryMissing: @raise ParentNotADirectoryError: ''' Inode.__init__(self, inode) self.fs = fs self._offset = 0 self._freeSpace = None connect(self.freespace, "FS.freespace")
def __init__(self, fs, path): self.path = path self.parent, self.name = split(path) self.fs = fs # Get the inode of the parent or raise ParentDirectoryMissing exception try: self.parent = send('Dir._Get_Inode', path=self.parent)[0][1] inode = send('Dir._Get_Inode', path=self.name, inode=self.parent)[0][1] except (FileNotFoundError, ParentDirectoryMissing): inode = None Inode.__init__(self, inode) # If inode is not a dir, raise error if inode and fs.db.Get_Mode(inode=inode) != S_IFDIR: raise NotADirectoryError(path)