@@ -986,47 +986,6 @@ impl GlobalContext {
986986 }
987987 }
988988
989- /// Get a list of strings.
990- ///
991- /// DO NOT USE outside of the config module. `pub` will be removed in the
992- /// future.
993- ///
994- /// NOTE: this does **not** support environment variables. Use `get` instead
995- /// if you want that.
996- pub fn get_list ( & self , key : & str ) -> CargoResult < OptValue < Vec < ( String , Definition ) > > > {
997- let key = ConfigKey :: from_str ( key) ;
998- self . _get_list ( & key)
999- }
1000-
1001- fn _get_list ( & self , key : & ConfigKey ) -> CargoResult < OptValue < Vec < ( String , Definition ) > > > {
1002- match self . get_cv ( key) ? {
1003- Some ( CV :: List ( val, definition) ) => Ok ( Some ( Value { val, definition } ) ) ,
1004- Some ( val) => self . expected ( "list" , key, & val) ,
1005- None => Ok ( None ) ,
1006- }
1007- }
1008-
1009- /// Helper for `StringList` type to get something that is a string or list.
1010- fn get_list_or_string ( & self , key : & ConfigKey ) -> CargoResult < Vec < ( String , Definition ) > > {
1011- let mut res = Vec :: new ( ) ;
1012-
1013- match self . get_cv ( key) ? {
1014- Some ( CV :: List ( val, _def) ) => res. extend ( val) ,
1015- Some ( CV :: String ( val, def) ) => {
1016- let split_vs = val. split_whitespace ( ) . map ( |s| ( s. to_string ( ) , def. clone ( ) ) ) ;
1017- res. extend ( split_vs) ;
1018- }
1019- Some ( val) => {
1020- return self . expected ( "string or array of strings" , key, & val) ;
1021- }
1022- None => { }
1023- }
1024-
1025- self . get_env_list ( key, & mut res) ?;
1026-
1027- Ok ( res)
1028- }
1029-
1030989 /// Internal method for getting an environment variable as a list.
1031990 /// If the key is a non-mergeable list and a value is found in the environment, existing values are cleared.
1032991 fn get_env_list (
@@ -1807,6 +1766,17 @@ impl GlobalContext {
18071766 . unwrap_or_else ( || PathBuf :: from ( tool_str) )
18081767 }
18091768
1769+ /// Get the `paths` overrides config value.
1770+ pub fn paths_overrides ( & self ) -> CargoResult < OptValue < Vec < ( String , Definition ) > > > {
1771+ let key = ConfigKey :: from_str ( "paths" ) ;
1772+ // paths overrides cannot be set via env config, so use get_cv here.
1773+ match self . get_cv ( & key) ? {
1774+ Some ( CV :: List ( val, definition) ) => Ok ( Some ( Value { val, definition } ) ) ,
1775+ Some ( val) => self . expected ( "list" , & key, & val) ,
1776+ None => Ok ( None ) ,
1777+ }
1778+ }
1779+
18101780 pub fn jobserver_from_env ( & self ) -> Option < & jobserver:: Client > {
18111781 self . jobserver . as_ref ( )
18121782 }
0 commit comments