File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use context::*;
1818use crate :: Crate ;
1919use messages:: * ;
2020use 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 } ;
2222use util:: compile_crate;
2323use workspace:: is_workspace;
2424use workcache_support;
@@ -166,12 +166,14 @@ impl PkgSrc {
166166 url, clone_target. to_str( ) , pkgid. version. to_str( ) ) ;
167167
168168 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 ( ) )
172174 }
173175 else {
174- Some ( local . clone ( ) )
176+ None
175177 }
176178 }
177179 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;
4343/// succeeded.
4444pub fn make_dir_rwx ( p : & Path ) -> bool { os:: make_dir ( p, U_RWX ) }
4545
46+ pub fn make_dir_rwx_recursive ( p : & Path ) -> bool { os:: mkdir_recursive ( p, U_RWX ) }
47+
4648// n.b. The next three functions ignore the package version right
4749// now. Should fix that.
4850
You can’t perform that action at this time.
0 commit comments