@@ -1000,23 +1000,8 @@ impl Build {
10001000 let mut objects = Vec :: new ( ) ;
10011001 for file in self . files . iter ( ) {
10021002 let obj = if file. has_root ( ) {
1003- // If `file` is an absolute path, try to remove the part
1004- // common with the destination directory, and graft the
1005- // remaining part. Most common outcome would be removal
1006- // of the home directory, next common - removal of the root
1007- // directory.
1008- let mut pre = dst. components ( ) ;
1009- let mut dst = dst. clone ( ) ;
1010- for comp in file. components ( ) {
1011- if comp != pre. next ( ) . unwrap_or ( Component :: CurDir ) {
1012- match comp {
1013- Component :: Normal ( c) => dst. push ( c) ,
1014- _ => ( ) ,
1015- } ;
1016- }
1017- }
1018- // ... and prefix the `basename` with the `dirname`'s hash
1019- // to ensure name uniqueness.
1003+ // If `file` is an absolute path, prefix the `basename`
1004+ // with the `dirname`'s hash to ensure name uniqueness.
10201005 let basename = file
10211006 . file_name ( )
10221007 . ok_or_else ( || Error :: new ( ErrorKind :: InvalidArgument , "file_name() failure" ) ) ?
@@ -1027,10 +1012,8 @@ impl Build {
10271012 . to_string_lossy ( ) ;
10281013 let mut hasher = hash_map:: DefaultHasher :: new ( ) ;
10291014 hasher. write ( dirname. to_string ( ) . as_bytes ( ) ) ;
1030- if dst. pop ( ) {
1031- dst. push ( format ! ( "{:016x}-{}" , hasher. finish( ) , basename) ) ;
1032- }
1033- dst. with_extension ( "o" )
1015+ dst. join ( format ! ( "{:016x}-{}" , hasher. finish( ) , basename) )
1016+ . with_extension ( "o" )
10341017 } else {
10351018 dst. join ( file) . with_extension ( "o" )
10361019 } ;
0 commit comments