public JSONObject getFileForLocalURL()

in src/android/AssetFilesystem.java [210:241]


    public JSONObject getFileForLocalURL(LocalFilesystemURL inputURL,
                                         String path, JSONObject options, boolean directory)
            throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
        if (options != null && options.optBoolean("create")) {
            throw new UnsupportedOperationException("Assets are read-only");
        }

        // Check whether the supplied path is absolute or relative
        if (directory && !path.endsWith("/")) {
            path += "/";
        }

        LocalFilesystemURL requestedURL;
        if (path.startsWith("/")) {
            requestedURL = localUrlforFullPath(normalizePath(path));
        } else {
            requestedURL = localUrlforFullPath(normalizePath(inputURL.path + "/" + path));
        }

        // Throws a FileNotFoundException if it doesn't exist.
        getFileMetadataForLocalURL(requestedURL);

        boolean isDir = isDirectory(requestedURL.path);
        if (directory && !isDir) {
            throw new TypeMismatchException("path doesn't exist or is file");
        } else if (!directory && isDir) {
            throw new TypeMismatchException("path doesn't exist or is directory");
        }

        // Return the directory
        return makeEntryForURL(requestedURL);
    }