(path: &Path)
| 434 | } |
| 435 | |
| 436 | fn load_toml_table(path: &Path) -> Result<Option<toml::Table>, ConfigError> { |
| 437 | if !path.exists() { |
| 438 | return Ok(None); |
| 439 | } |
| 440 | |
| 441 | let content = std::fs::read_to_string(path).map_err(|e| ConfigError::Io { |
| 442 | path: path.display().to_string(), |
| 443 | source: e, |
| 444 | })?; |
| 445 | |
| 446 | let table: toml::Table = content.parse().map_err(|e| ConfigError::Parse { |
| 447 | path: path.display().to_string(), |
| 448 | source: e, |
| 449 | })?; |
| 450 | |
| 451 | Ok(Some(table)) |
| 452 | } |
| 453 | |
| 454 | /// Load the project configuration, merging the global config (from the |
| 455 | /// user's XDG config directory) with the project-level `.phpantom.toml`. |
no test coverage detected