How to use the cordova-plugin-file.bb10FileSystemInfo.temporaryPath function in cordova-plugin-file

To help you get started, we’ve selected a few cordova-plugin-file examples, based on popular ways it is used in public projects.

github apache / cordova-plugin-file / www / blackberry10 / createEntryFromNative.js View on Github external
isFile: !!native.isFile,
        name: native.name,
        fullPath: native.fullPath,
        filesystemName: native.filesystem.name,
        nativeURL: native.toURL()
    };
    var persistentPath = info.persistentPath.substring(7);
    var temporaryPath = info.temporaryPath.substring(7);
    // fix bb10 webkit incorrect nativeURL
    if (native.filesystem.name === 'root') {
        /* eslint-disable no-undef */
        entry.nativeURL = 'file:///' + FileSystem.encodeURIPath(native.fullPath);
    } else if (entry.nativeURL.indexOf('filesystem:local:///persistent/') === 0) {
        entry.nativeURL = info.persistentPath + FileSystem.encodeURIPath(native.fullPath);
    } else if (entry.nativeURL.indexOf('filesystem:local:///temporary') === 0) {
        entry.nativeURL = info.temporaryPath + FileSystem.encodeURIPath(native.fullPath);
    }
    /* eslint-enable no-undef */
    // translate file system name from bb10 webkit
    if (entry.filesystemName === 'local__0:Persistent' || entry.fullPath.indexOf(persistentPath) !== -1) {
        entry.filesystemName = 'persistent';
    } else if (entry.filesystemName === 'local__0:Temporary' || entry.fullPath.indexOf(temporaryPath) !== -1) {
        entry.filesystemName = 'temporary';
    }
    // add file system property (will be called sync)
    fileSystems.getFs(entry.filesystemName, function (fs) {
        entry.filesystem = fs;
    });
    // set root on fullPath for persistent / temporary locations
    entry.fullPath = entry.fullPath.replace(persistentPath, '');
    entry.fullPath = entry.fullPath.replace(temporaryPath, '');
    // set trailing slash on directory
github apache / cordova-plugin-file / www / blackberry10 / FileSystem.js View on Github external
__format__: function (fullPath) {
        var path;
        switch (this.name) {
        case 'temporary':
            /* eslint-disable no-undef */
            path = info.temporaryPath + FileSystem.encodeURIPath(fullPath);
            break;
        case 'persistent':
            path = info.persistentPath + FileSystem.encodeURIPath(fullPath);
            break;
        case 'root':
            path = 'file://' + FileSystem.encodeURIPath(fullPath);
            /* eslint-enable no-undef */
            break;
        }
        return path;
    }
};
github apache / cordova-plugin-file / www / blackberry10 / createEntryFromNative.js View on Github external
module.exports = function (native) {
    var entry = {
        nativeEntry: native,
        isDirectory: !!native.isDirectory,
        isFile: !!native.isFile,
        name: native.name,
        fullPath: native.fullPath,
        filesystemName: native.filesystem.name,
        nativeURL: native.toURL()
    };
    var persistentPath = info.persistentPath.substring(7);
    var temporaryPath = info.temporaryPath.substring(7);
    // fix bb10 webkit incorrect nativeURL
    if (native.filesystem.name === 'root') {
        /* eslint-disable no-undef */
        entry.nativeURL = 'file:///' + FileSystem.encodeURIPath(native.fullPath);
    } else if (entry.nativeURL.indexOf('filesystem:local:///persistent/') === 0) {
        entry.nativeURL = info.persistentPath + FileSystem.encodeURIPath(native.fullPath);
    } else if (entry.nativeURL.indexOf('filesystem:local:///temporary') === 0) {
        entry.nativeURL = info.temporaryPath + FileSystem.encodeURIPath(native.fullPath);
    }
    /* eslint-enable no-undef */
    // translate file system name from bb10 webkit
    if (entry.filesystemName === 'local__0:Persistent' || entry.fullPath.indexOf(persistentPath) !== -1) {
        entry.filesystemName = 'persistent';
    } else if (entry.filesystemName === 'local__0:Temporary' || entry.fullPath.indexOf(temporaryPath) !== -1) {
        entry.filesystemName = 'temporary';
    }
github apache / cordova-plugin-file / www / blackberry10 / resolveLocalFileSystemURI.js View on Github external
var request = args[0];
    var options = args[1];
    var size = args[2];
    if (request) {
        request = decodeURIComponent(request);
        if (request.indexOf('?') > -1) {
            // bb10 does not support params; strip them off
            request = request.substring(0, request.indexOf('?'));
        }
        if (request.indexOf('file://localhost/') === 0) {
            // remove localhost prefix
            request = request.replace('file://localhost/', 'file:///');
        }
        // requests to sandboxed locations should use cdvfile
        request = request.replace(info.persistentPath, 'cdvfile://localhost/persistent');
        request = request.replace(info.temporaryPath, 'cdvfile://localhost/temporary');
        // pick appropriate handler
        if (request.indexOf('file:///') === 0) {
            resolveFile(success, fail, request, options);
        } else if (request.indexOf('cdvfile://localhost/') === 0) {
            resolveCdvFile(success, fail, request, options, size);
        } else if (request.indexOf('local:///') === 0) {
            resolveLocal(success, fail, request, options);
        } else {
            fail(FileError.ENCODING_ERR); // eslint-disable-line no-undef
        }
    } else {
        fail(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
    }
};
github apache / cordova-plugin-file / www / blackberry10 / requestAllFileSystems.js View on Github external
module.exports = function (success, fail, args) {
    success([
        { filesystemName: 'persistent', name: 'persistent', fullPath: '/', nativeURL: info.persistentPath + '/' },
        { filesystemName: 'temporary', name: 'temporary', fullPath: '/', nativeURL: info.temporaryPath + '/' },
        { filesystemName: 'root', name: 'root', fullPath: '/', nativeURL: 'file:///' }
    ]);
};
github jolocom / smartwallet-app / app / plugins / cordova-plugin-file / www / blackberry10 / FileSystem.js View on Github external
__format__: function(fullPath) {
        var path;
        switch (this.name) {
            case 'temporary':
                path = info.temporaryPath + FileSystem.encodeURIPath(fullPath);
                break;
            case 'persistent':
                path = info.persistentPath + FileSystem.encodeURIPath(fullPath);
                break;
            case 'root':
                path = 'file://' + FileSystem.encodeURIPath(fullPath);
                break;
        }
        return path;
    }
};