def getLocalFilePath(self, file):
        """
        If an assetstore adapter supports it, return a path to the file on the
        local file system.  Otherwise, raise an exception.

        :param file: The file document.
        :type file: dict
        :returns: a local path to the file.
        :rtype: str
        """
        raise FilePathException('This assetstore does not expose file paths')
Пример #2
0
    def getGirderMountFilePath(self, file, validate=True):
        """
        If possible, get the path of the file on a local girder mount.

        :param file: The file document.
        :param validate: if True, check if the path exists and raise an
            exception if it does not.
        :returns: a girder mount path to the file or None if no such path is
            available.
        """
        mount = Setting().get(SettingKey.GIRDER_MOUNT_INFORMATION, None)
        if mount:
            path = mount['path'].rstrip('/') + path_util.getResourcePath('file', file, force=True)
            if not validate or os.path.exists(path):
                return path
        if validate:
            raise FilePathException('This file isn\'t accessible from a Girder mount.')