getParent: function()

in src/windows/FileProxy.js [539:560]


    getParent: function (win, fail, args) { // ["fullPath"]
        const fs = getFilesystemFromURL(args[0]);
        const path = pathFromURL(args[0]);
        if (!fs || !validName(path)) {
            fail(FileError.ENCODING_ERR);
            return;
        }
        if (!path || (new RegExp('/[^/]*/?$')).test(path)) {
            win(new DirectoryEntry(fs.root.name, fs.root.fullPath, fs.name, fs.makeNativeURL(fs.root.fullPath)));
            return;
        }

        const parpath = path.replace(new RegExp('/[^/]+/?$', 'g'), '');
        const parname = path.substr(parpath.length);
        const fullPath = cordovaPathToNative(fs.winpath + parpath);

        const result = new DirectoryEntry(parname, parpath, fs.name, fs.makeNativeURL(parpath));
        getFolderFromPathAsync(fullPath).done(
            function () { win(result); },
            function () { fail(FileError.INVALID_STATE_ERR); }
        );
    },