File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use context::*;
18
18
use crate :: Crate ;
19
19
use messages:: * ;
20
20
use source_control:: { git_clone, git_clone_general} ;
21
- use path_util:: { find_dir_using_rust_path_hack, default_workspace} ;
21
+ use path_util:: { find_dir_using_rust_path_hack, default_workspace, make_dir_rwx_recursive } ;
22
22
use util:: compile_crate;
23
23
use workspace:: is_workspace;
24
24
use workcache_support;
@@ -166,12 +166,14 @@ impl PkgSrc {
166
166
url, clone_target. to_str( ) , pkgid. version. to_str( ) ) ;
167
167
168
168
if git_clone_general ( url, & clone_target, & pkgid. version ) {
169
- // since the operation succeeded, move clone_target to local
170
- if !os:: rename_file ( & clone_target, local) {
171
- None
169
+ // Since the operation succeeded, move clone_target to local.
170
+ // First, create all ancestor directories.
171
+ if make_dir_rwx_recursive ( & local. pop ( ) )
172
+ && os:: rename_file ( & clone_target, local) {
173
+ Some ( local. clone ( ) )
172
174
}
173
175
else {
174
- Some ( local . clone ( ) )
176
+ None
175
177
}
176
178
}
177
179
else {
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ pub static U_RWX: i32 = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
43
43
/// succeeded.
44
44
pub fn make_dir_rwx ( p : & Path ) -> bool { os:: make_dir ( p, U_RWX ) }
45
45
46
+ pub fn make_dir_rwx_recursive ( p : & Path ) -> bool { os:: mkdir_recursive ( p, U_RWX ) }
47
+
46
48
// n.b. The next three functions ignore the package version right
47
49
// now. Should fix that.
48
50
You can’t perform that action at this time.
0 commit comments