Clean up config.rs #8

Closed
MarkusPettersson98 wants to merge 1 commit from typesafe-get-config-location into main

1 commit

Author SHA1 Message Date
Markus Pettersson
ef7e431779 Clean up config.rs
Some refactoring to `config.rs` with the aim to:

* Increase type safety
* Reduce duplication
* Leverage `std::result::Result` & `std::path::PathBuf` APIs

To achieve these goals, the following was done:

* `get_config_file` propagates an `FF2MpvError` if the config file doesn't exist/is invalid
* Always type check `unix` & `windows` code by using `cfg!` expressions over
`#[cfg()]` attributes. This also removed some duplicated lines of code
* Move `#[serde(default)]` to `Config` struct instead of every struct
member: https://serde.rs/container-attrs.html#default
2023-10-29 20:04:15 +01:00