1
1
//! Files, and methods and fields to access their metadata.
2
2
3
- use std:: fs:: { self , metadata} ;
4
3
use std:: io:: Error as IOError ;
5
4
use std:: io:: Result as IOResult ;
6
5
use std:: os:: unix:: fs:: { MetadataExt , PermissionsExt , FileTypeExt } ;
7
6
use std:: path:: { Path , PathBuf } ;
8
- use std:: time:: { SystemTime , UNIX_EPOCH , Duration } ;
7
+ use std:: time:: { UNIX_EPOCH , Duration } ;
9
8
10
9
use log:: { debug, error} ;
11
10
12
11
use crate :: fs:: dir:: Dir ;
13
12
use crate :: fs:: fields as f;
14
- use crate :: options:: Misfire ;
15
-
16
13
17
14
/// A **File** is a wrapper around one of Rust's Path objects, along with
18
15
/// associated data about the file.
@@ -48,7 +45,7 @@ pub struct File<'dir> {
48
45
/// This too is queried multiple times, and is *not* cached by the OS, as
49
46
/// it could easily change between invocations — but exa is so short-lived
50
47
/// it's better to just cache it.
51
- pub metadata : fs:: Metadata ,
48
+ pub metadata : std :: fs:: Metadata ,
52
49
53
50
/// A reference to the directory that contains this file, if any.
54
51
///
@@ -78,7 +75,7 @@ impl<'dir> File<'dir> {
78
75
let ext = File :: ext ( & path) ;
79
76
80
77
debug ! ( "Statting file {:?}" , & path) ;
81
- let metadata = fs:: symlink_metadata ( & path) ?;
78
+ let metadata = std :: fs:: symlink_metadata ( & path) ?;
82
79
let is_all_all = false ;
83
80
84
81
Ok ( File { path, parent_dir, metadata, ext, name, is_all_all } )
@@ -89,7 +86,7 @@ impl<'dir> File<'dir> {
89
86
let ext = File :: ext ( & path) ;
90
87
91
88
debug ! ( "Statting file {:?}" , & path) ;
92
- let metadata = fs:: symlink_metadata ( & path) ?;
89
+ let metadata = std :: fs:: symlink_metadata ( & path) ?;
93
90
let is_all_all = true ;
94
91
95
92
Ok ( File { path, parent_dir : Some ( parent_dir) , metadata, ext, name : "." . to_string ( ) , is_all_all } )
@@ -99,7 +96,7 @@ impl<'dir> File<'dir> {
99
96
let ext = File :: ext ( & path) ;
100
97
101
98
debug ! ( "Statting file {:?}" , & path) ;
102
- let metadata = fs:: symlink_metadata ( & path) ?;
99
+ let metadata = std :: fs:: symlink_metadata ( & path) ?;
103
100
let is_all_all = true ;
104
101
105
102
Ok ( File { path, parent_dir : Some ( parent_dir) , metadata, ext, name : ".." . to_string ( ) , is_all_all } )
@@ -239,7 +236,7 @@ impl<'dir> File<'dir> {
239
236
// we actually look up and turn into a `File` — which needs to be
240
237
// absolute to be accessible from any directory.
241
238
debug ! ( "Reading link {:?}" , & self . path) ;
242
- let path = match fs:: read_link ( & self . path ) {
239
+ let path = match std :: fs:: read_link ( & self . path ) {
243
240
Ok ( p) => p,
244
241
Err ( e) => return FileTarget :: Err ( e) ,
245
242
} ;
@@ -248,7 +245,7 @@ impl<'dir> File<'dir> {
248
245
249
246
// Use plain `metadata` instead of `symlink_metadata` - we *want* to
250
247
// follow links.
251
- match fs:: metadata ( & absolute_path) {
248
+ match std :: fs:: metadata ( & absolute_path) {
252
249
Ok ( metadata) => {
253
250
let ext = File :: ext ( & path) ;
254
251
let name = File :: filename ( & path) ;
0 commit comments