'Use TSK to read the pathspec.
Args:
base_fd: The file like object we read this component from.
pathspec: An optional pathspec to open directly.
progress_callback: A callback to indicate that the open call is still
working but needs more time.
full_pathspec: The full pathspec we are trying to open.
Raises:
IOError: If the file can not be opened.'

def __init__(self, base_fd, pathspec=None, progress_callback=None, full_pathspec=None):

    super(TSKFile, self).__init__(base_fd, pathspec=pathspec, progress_callback=progress_callback, full_pathspec=full_pathspec)
    if (self.base_fd is None):
        raise IOError('TSK    driver    must    have    a    file    base.')
    elif (isinstance(base_fd, TSKFile) and self.base_fd.IsDirectory()):
        self.tsk_raw_device = self.base_fd.tsk_raw_device
        last_path = utils.JoinPath(self.pathspec.last.path, pathspec.path)
        self.pathspec.Pop((-1))
        self.pathspec.Append(pathspec)
        self.pathspec.last.path = last_path
    elif (not self.base_fd.IsDirectory()):
        self.tsk_raw_device = self.base_fd
        self.pathspec.Append(pathspec)
    else:
        raise IOError('Unable    to    parse    base    using    Sleuthkit.')
    self.pathspec.last.path_options = rdf_paths.PathSpec.Options.CASE_LITERAL
    fd_hash = self.tsk_raw_device.pathspec.SerializeToString()
    try:
        self.filesystem = vfs.DEVICE_CACHE.Get(fd_hash)
        self.fs = self.filesystem.fs
    except KeyError:
        self.img = MyImgInfo(fd=self.tsk_raw_device, progress_callback=progress_callback)
        self.fs = pytsk3.FS_Info(self.img, 0)
        self.filesystem = CachedFilesystem(self.fs, self.img)
        vfs.DEVICE_CACHE.Put(fd_hash, self.filesystem)
    if pathspec.HasField('inode'):
        self.fd = self.fs.open_meta(pathspec.inode)
        self.tsk_attribute = self.GetAttribute(pathspec.ntfs_type, pathspec.ntfs_id)
        if self.tsk_attribute:
            self.size = self.tsk_attribute.info.size
        else:
            self.size = self.fd.info.meta.size
    else:
        self.fd = self.fs.open(utils.SmartStr(self.pathspec.last.path))
        self.size = self.fd.info.meta.size
        self.pathspec.last.inode = self.fd.info.meta.addr
