File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,18 +20,21 @@ fn config_home() -> PathBuf {
2020 }
2121}
2222
23+ fn resolve_config_path ( override_path : Option < PathBuf > ) -> PathBuf {
24+ match override_path {
25+ Some ( path) if path. is_dir ( ) => path. join ( "config.toml" ) ,
26+ Some ( path) => path,
27+ None => config_home ( ) . join ( "config.toml" ) ,
28+ }
29+ }
30+
2331/// Goes around and initializes vital stuff for config to
2432/// be read and written
2533pub fn init_ring (
2634 // used to override a path, e.g -c / --config
2735 override_default_path : Option < PathBuf > ,
2836) {
29- let maybe_file = override_default_path. unwrap_or_else ( config_home) ;
30- let config_path = if maybe_file. is_dir ( ) {
31- maybe_file. join ( "config.toml" )
32- } else {
33- maybe_file. to_path_buf ( )
34- } ;
37+ let config_path = resolve_config_path ( override_default_path) ;
3538
3639 let inner_config = if config_path. is_file ( ) {
3740 let raw = std:: fs:: read_to_string ( & config_path)
You can’t perform that action at this time.
0 commit comments