File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 61
61
html_root_url = "https://docs.rs/glob/0.3.0"
62
62
) ]
63
63
#![ deny( missing_docs) ]
64
- #![ cfg_attr( all( test, windows) , feature( std_misc) ) ]
65
64
66
65
#[ cfg( test) ]
67
66
#[ macro_use]
@@ -177,7 +176,6 @@ pub fn glob(pattern: &str) -> Result<Paths, PatternError> {
177
176
pub fn glob_with ( pattern : & str , options : MatchOptions ) -> Result < Paths , PatternError > {
178
177
#[ cfg( windows) ]
179
178
fn check_windows_verbatim ( p : & Path ) -> bool {
180
- use std:: path:: Prefix ;
181
179
match p. components ( ) . next ( ) {
182
180
Some ( Component :: Prefix ( ref p) ) => p. kind ( ) . is_verbatim ( ) ,
183
181
_ => false ,
@@ -1086,12 +1084,21 @@ mod test {
1086
1084
#[ cfg( windows) ]
1087
1085
fn win ( ) {
1088
1086
use std:: env:: current_dir;
1089
- use std:: ffi :: AsOsStr ;
1087
+ use std:: path :: Component ;
1090
1088
1091
1089
// check windows absolute paths with host/device components
1092
1090
let root_with_device = current_dir ( )
1093
1091
. ok ( )
1094
- . and_then ( |p| p. prefix ( ) . map ( |p| p. join ( "*" ) ) )
1092
+ . and_then ( |p| {
1093
+ match p. components ( ) . next ( ) . unwrap ( ) {
1094
+ Component :: Prefix ( prefix_component) => {
1095
+ let path = Path :: new ( prefix_component. as_os_str ( ) ) ;
1096
+ path. join ( "*" ) ;
1097
+ Some ( path. to_path_buf ( ) )
1098
+ }
1099
+ _ => panic ! ( "no prefix in this path" ) ,
1100
+ }
1101
+ } )
1095
1102
. unwrap ( ) ;
1096
1103
// FIXME (#9639): This needs to handle non-utf8 paths
1097
1104
assert ! ( glob( root_with_device. as_os_str( ) . to_str( ) . unwrap( ) )
You can’t perform that action at this time.
0 commit comments