| 33 | } |
| 34 | |
| 35 | fn init_extensions_dir(path: PathBuf) -> anyhow::Result<cap_std::fs::Dir> { |
| 36 | let extensions_dir = path.join("extensions"); |
| 37 | std::fs::create_dir_all(&extensions_dir).with_context(|| { |
| 38 | format!( |
| 39 | "Could not create directory at: {}", |
| 40 | extensions_dir.display() |
| 41 | ) |
| 42 | })?; |
| 43 | let std_dir = std::fs::File::open(&extensions_dir).with_context(|| { |
| 44 | format!("Could not open directory at: {}", extensions_dir.display()) |
| 45 | })?; |
| 46 | let cap_dir = cap_std::fs::Dir::from_std_file(std_dir); |
| 47 | Ok(cap_dir) |
| 48 | } |
| 49 | |
| 50 | /// Gets the basename of the extension config file. |
| 51 | fn config_file_name(&self) -> String { |