File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
use failure:: Error ;
2
+ use std:: fs;
2
3
use std:: path:: { Path , PathBuf } ;
3
4
use std:: process:: { Child , Command } ;
4
5
use walkdir:: WalkDir ;
@@ -66,10 +67,21 @@ impl Zfs {
66
67
let mut dst = PathBuf :: new ( ) ;
67
68
dst. push ( & target) ;
68
69
dst. push ( src. strip_prefix ( & self . target ) ?) ;
69
- if entry. file_type ( ) . is_dir ( ) {
70
+
71
+ let typ = entry. file_type ( ) ;
72
+ if typ. is_dir ( ) {
73
+ debug ! ( "creating directory {:?}" , dst) ;
70
74
std:: fs:: create_dir_all ( dst) ?;
71
- } else {
75
+ } else if typ. is_file ( ) {
76
+ debug ! ( "installing file {:?}" , dst) ;
72
77
std:: fs:: copy ( & src, & dst) ?;
78
+ } else if typ. is_symlink ( ) {
79
+ let _ = fs:: remove_file ( & dst) ; // we don't care if file does not exist
80
+ let target = fs:: read_link ( src) ?;
81
+ debug ! ( "linking file {:?} -> {:?}" , dst, target) ;
82
+ std:: os:: unix:: fs:: symlink ( & dst, target) ?;
83
+ } else {
84
+ error ! ( "unsupported file type: ({:?}): {:?}" , src, typ)
73
85
}
74
86
}
75
87
You can’t perform that action at this time.
0 commit comments