@@ -7,68 +7,15 @@ use std::{
77#[ cfg( unix) ]
88use std:: str:: FromStr ;
99
10- #[ cfg( windows) ]
11- use std:: {
12- fmt,
13- hash:: { Hash , Hasher } ,
10+ use crate :: {
11+ platform_case_aware_env_key:: { construct_platform_case_aware_env_key, PlatformCaseAwareEnvKey } ,
12+ types:: Installation ,
1413} ;
1514
16- #[ cfg( windows) ]
17- #[ derive( Clone ) ]
18- pub struct CaseInsensitiveKey ( pub String ) ;
19-
20- #[ cfg( windows) ]
21- impl PartialEq for CaseInsensitiveKey {
22- fn eq ( & self , other : & Self ) -> bool {
23- self . 0 . eq_ignore_ascii_case ( & other. 0 )
24- }
25- }
26-
27- #[ cfg( windows) ]
28- impl fmt:: Display for CaseInsensitiveKey {
29- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
30- write ! ( f, "{}" , self . 0 )
31- }
32- }
33-
34- #[ cfg( windows) ]
35- impl Eq for CaseInsensitiveKey { }
36-
37- #[ cfg( windows) ]
38- impl Hash for CaseInsensitiveKey {
39- fn hash < H : Hasher > ( & self , state : & mut H ) {
40- self . 0 . to_lowercase ( ) . hash ( state) ;
41- }
42- }
43-
44- #[ cfg( windows) ]
45- impl fmt:: Debug for CaseInsensitiveKey {
46- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
47- write ! ( f, "{:?}" , self . 0 )
48- }
49- }
50-
51- #[ cfg( windows) ]
52- pub type PlatformCaseAwareEnvKey = CaseInsensitiveKey ;
53- #[ cfg( not( windows) ) ]
54- pub type PlatformCaseAwareEnvKey = String ;
55-
56- #[ cfg( windows) ]
57- pub fn construct_platform_case_aware_env_key ( key : String ) -> PlatformCaseAwareEnvKey {
58- CaseInsensitiveKey ( key)
59- }
60-
61- #[ cfg( not( windows) ) ]
62- pub fn construct_platform_case_aware_env_key ( key : String ) -> PlatformCaseAwareEnvKey {
63- key
64- }
65-
66- use crate :: types:: Installation ;
67-
6815#[ cfg( unix) ]
69- const SEP : & str = ":" ;
16+ pub const SEP : & str = ":" ;
7017#[ cfg( windows) ]
71- const SEP : & str = ";" ;
18+ pub const SEP : & str = ";" ;
7219
7320pub fn map ( installations : & Vec < Installation > ) -> HashMap < String , Vec < String > > {
7421 let mut vars: HashMap < EnvKey , OrderedSet < PathBuf > > = HashMap :: new ( ) ;
0 commit comments