| 1081 | } |
| 1082 | |
| 1083 | fn parse_packaged_manifest(path: &Path) -> Result<BTreeMap<String, PackagedExtension>> { |
| 1084 | if !path.exists() { |
| 1085 | return Ok(BTreeMap::new()); |
| 1086 | } |
| 1087 | let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?; |
| 1088 | let manifest: AssetManifest = |
| 1089 | serde_json::from_str(&text).with_context(|| format!("parse {}", path.display()))?; |
| 1090 | Ok(manifest |
| 1091 | .extensions |
| 1092 | .into_iter() |
| 1093 | .map(|extension| { |
| 1094 | ( |
| 1095 | extension.sql_name, |
| 1096 | PackagedExtension { |
| 1097 | archive: Some(extension.archive), |
| 1098 | module_sha256: Some(extension.module_sha256), |
| 1099 | stable: extension.stable, |
| 1100 | }, |
| 1101 | ) |
| 1102 | }) |
| 1103 | .collect()) |
| 1104 | } |
| 1105 | |
| 1106 | fn parse_other_extension_submodules(path: &Path) -> Result<BTreeMap<String, SubmodulePin>> { |
| 1107 | let gitmodules = path |