File tree 6 files changed +19
-17
lines changed
6 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ libc = "0.2.81"
36
36
# for testing here.
37
37
nt_version = " 0.1.3"
38
38
winapi = " 0.3.9"
39
- winx = " 0.22 .0"
39
+ winx = " 0.23 .0"
40
40
41
41
[features ]
42
42
default = []
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ errno = "0.2.7"
37
37
errno = " 0.2.7"
38
38
39
39
[target .'cfg(windows)' .dependencies ]
40
- winx = " 0.22 .0"
40
+ winx = " 0.23 .0"
41
41
winapi = { version = " 0.3.9" , features = [
42
42
" ioapiset" ,
43
43
" winioctl"
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ use std::{
9
9
} ,
10
10
path:: { Path , PathBuf } ,
11
11
} ;
12
+ use winapi:: um:: winbase:: FILE_FLAG_BACKUP_SEMANTICS ;
12
13
use winapi:: um:: winnt;
13
- use winx:: file:: Flags ;
14
14
15
15
/// Rust's `Path` implicitly strips redundant slashes, however they aren't
16
16
/// redundant in one case: at the end of a path they indicate that a path is
@@ -68,7 +68,7 @@ pub(crate) fn dir_options() -> OpenOptions {
68
68
OpenOptions :: new ( )
69
69
. read ( true )
70
70
. dir_required ( true )
71
- . custom_flags ( Flags :: FILE_FLAG_BACKUP_SEMANTICS . bits ( ) )
71
+ . custom_flags ( FILE_FLAG_BACKUP_SEMANTICS )
72
72
. share_mode ( winnt:: FILE_SHARE_READ | winnt:: FILE_SHARE_WRITE )
73
73
. clone ( )
74
74
}
@@ -83,7 +83,7 @@ pub(crate) fn readdir_options() -> OpenOptions {
83
83
pub ( crate ) fn canonicalize_options ( ) -> OpenOptions {
84
84
OpenOptions :: new ( )
85
85
. read ( true )
86
- . custom_flags ( Flags :: FILE_FLAG_BACKUP_SEMANTICS . bits ( ) )
86
+ . custom_flags ( FILE_FLAG_BACKUP_SEMANTICS )
87
87
. clone ( )
88
88
}
89
89
@@ -100,7 +100,7 @@ pub(crate) unsafe fn open_ambient_dir_impl(path: &Path) -> io::Result<fs::File>
100
100
// underneath us, since we use paths to implement many directory operations.
101
101
let dir = fs:: OpenOptions :: new ( )
102
102
. read ( true )
103
- . custom_flags ( Flags :: FILE_FLAG_BACKUP_SEMANTICS . bits ( ) )
103
+ . custom_flags ( FILE_FLAG_BACKUP_SEMANTICS )
104
104
. share_mode ( winnt:: FILE_SHARE_READ | winnt:: FILE_SHARE_WRITE )
105
105
. open ( & path) ?;
106
106
Original file line number Diff line number Diff line change 1
1
#![ allow( clippy:: useless_conversion) ]
2
2
3
- use std:: { fs, io} ;
3
+ use std:: { convert :: TryInto , fs, io} ;
4
4
5
5
#[ derive( Debug , Clone ) ]
6
6
pub ( crate ) struct MetadataExt {
@@ -38,17 +38,19 @@ impl MetadataExt {
38
38
39
39
#[ cfg( not( windows_by_handle) ) ]
40
40
if volume_serial_number. is_none ( ) || number_of_links. is_none ( ) || file_index. is_none ( ) {
41
- let fileinfo = winx :: file:: get_fileinfo ( file) ?;
41
+ let fileinfo = winapi_util :: file:: information ( file) ?;
42
42
if volume_serial_number. is_none ( ) {
43
- volume_serial_number = Some ( fileinfo. dwVolumeSerialNumber ) ;
43
+ let t64: u64 = fileinfo. volume_serial_number ( ) ;
44
+ let t32: u32 = t64. try_into ( ) . unwrap ( ) ;
45
+ volume_serial_number = Some ( t32) ;
44
46
}
45
47
if number_of_links. is_none ( ) {
46
- number_of_links = Some ( fileinfo. nNumberOfLinks ) ;
48
+ let t64: u64 = fileinfo. number_of_links ( ) ;
49
+ let t32: u32 = t64. try_into ( ) . unwrap ( ) ;
50
+ number_of_links = Some ( t32) ;
47
51
}
48
52
if file_index. is_none ( ) {
49
- file_index = Some (
50
- ( u64:: from ( fileinfo. nFileIndexHigh ) << 32 ) | u64:: from ( fileinfo. nFileIndexLow ) ,
51
- ) ;
53
+ file_index = Some ( fileinfo. file_index ( ) ) ;
52
54
}
53
55
}
54
56
Original file line number Diff line number Diff line change 1
1
use crate :: fs:: { FollowSymlinks , OpenOptions } ;
2
2
use std:: { fs, os:: windows:: fs:: OpenOptionsExt } ;
3
- use winx :: file :: Flags ;
3
+ use winapi :: um :: winbase :: { FILE_FLAG_BACKUP_SEMANTICS , FILE_FLAG_OPEN_REPARSE_POINT } ;
4
4
5
5
/// Translate the given `cap_std` into `std` options. Also return a bool
6
6
/// indicating that the `trunc` flag was requested but could not be set,
@@ -18,11 +18,11 @@ pub(in super::super) fn open_options_to_std(opts: &OpenOptions) -> (fs::OpenOpti
18
18
manually_trunc = true ;
19
19
trunc = false ;
20
20
}
21
- opts. ext . custom_flags | Flags :: FILE_FLAG_OPEN_REPARSE_POINT . bits ( )
21
+ opts. ext . custom_flags | FILE_FLAG_OPEN_REPARSE_POINT
22
22
}
23
23
} ;
24
24
if opts. maybe_dir {
25
- custom_flags |= Flags :: FILE_FLAG_BACKUP_SEMANTICS . bits ( ) ;
25
+ custom_flags |= FILE_FLAG_BACKUP_SEMANTICS ;
26
26
}
27
27
let mut std_opts = fs:: OpenOptions :: new ( ) ;
28
28
std_opts
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ posish = "0.5.2"
22
22
23
23
[target .'cfg(windows)' .dependencies ]
24
24
once_cell = " 1.5.2"
25
- winx = " 0.22 .0"
25
+ winx = " 0.23 .0"
26
26
27
27
[badges ]
28
28
maintenance = { status = " actively-developed" }
You can’t perform that action at this time.
0 commit comments