fn read_from_uri()

in native/src/work_asset/construct.rs [285:306]


    fn read_from_uri(uri: &str, file_base: Option<&Path>) -> Result<Vec<u8>> {
        // this is very temporary, lifted lifted from gltf::import.rs
        let path = if uri.contains(":") {
            if uri.starts_with("file://") {
                &uri["file://".len()..]
            } else if uri.starts_with("file:") {
                &uri["file:".len()..]
            } else {
                panic!("Can only handle file:// URIs yet.");
            }
        } else {
            &uri[..]
        };
        let mut path = PathBuf::from(path);
        if path.is_relative() {
            if let Some(file_base) = file_base {
                path = file_base.join(path);
            }
        }
        Ok(fs::read(path.as_path())
            .map_err(|e| format!("Error reading file {}: {}", path.display(), e.to_string()))?)
    }