@@ -20,8 +20,6 @@ use std::path::{Path, PathBuf};
20
20
use std:: process:: Command ;
21
21
use std:: time:: Instant ;
22
22
23
- use filetime:: FileTime ;
24
-
25
23
/// Returns the `name` as the filename of a static library for `target`.
26
24
pub fn staticlib ( name : & str , target : & str ) -> String {
27
25
if target. contains ( "windows" ) {
@@ -31,13 +29,6 @@ pub fn staticlib(name: &str, target: &str) -> String {
31
29
}
32
30
}
33
31
34
- /// Returns the last-modified time for `path`, or zero if it doesn't exist.
35
- pub fn mtime ( path : & Path ) -> FileTime {
36
- fs:: metadata ( path) . map ( |f| {
37
- FileTime :: from_last_modification_time ( & f)
38
- } ) . unwrap_or ( FileTime :: zero ( ) )
39
- }
40
-
41
32
/// Copies a file from `src` to `dst`, attempting to use hard links and then
42
33
/// falling back to an actually filesystem copy if necessary.
43
34
pub fn copy ( src : & Path , dst : & Path ) {
@@ -132,34 +123,6 @@ pub fn add_lib_path(path: Vec<PathBuf>, cmd: &mut Command) {
132
123
cmd. env ( dylib_path_var ( ) , t ! ( env:: join_paths( list) ) ) ;
133
124
}
134
125
135
- /// Returns whether `dst` is up to date given that the file or files in `src`
136
- /// are used to generate it.
137
- ///
138
- /// Uses last-modified time checks to verify this.
139
- pub fn up_to_date ( src : & Path , dst : & Path ) -> bool {
140
- let threshold = mtime ( dst) ;
141
- let meta = match fs:: metadata ( src) {
142
- Ok ( meta) => meta,
143
- Err ( e) => panic ! ( "source {:?} failed to get metadata: {}" , src, e) ,
144
- } ;
145
- if meta. is_dir ( ) {
146
- dir_up_to_date ( src, & threshold)
147
- } else {
148
- FileTime :: from_last_modification_time ( & meta) <= threshold
149
- }
150
- }
151
-
152
- fn dir_up_to_date ( src : & Path , threshold : & FileTime ) -> bool {
153
- t ! ( fs:: read_dir( src) ) . map ( |e| t ! ( e) ) . all ( |e| {
154
- let meta = t ! ( e. metadata( ) ) ;
155
- if meta. is_dir ( ) {
156
- dir_up_to_date ( & e. path ( ) , threshold)
157
- } else {
158
- FileTime :: from_last_modification_time ( & meta) < * threshold
159
- }
160
- } )
161
- }
162
-
163
126
/// Returns the environment variable which the dynamic library lookup path
164
127
/// resides in for this platform.
165
128
pub fn dylib_path_var ( ) -> & ' static str {
0 commit comments