Rollup merge of #116349 - onur-ozkan:hfix, r=tmandry

ensure the parent path's existence on `x install`

fixes https://github.com/rust-lang/rust/pull/116127#issuecomment-1743454109

cc `@tmandry`
This commit is contained in:
Tyler Mandry 2023-10-02 16:09:43 -04:00 committed by GitHub
commit d7621cdb19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,10 +46,10 @@ fn sanitize_sh(path: &Path) -> String {
}
fn is_dir_writable_for_user(dir: &PathBuf) -> bool {
let tmp_file = dir.join(".tmp");
match fs::File::create(&tmp_file) {
let tmp = dir.join(".tmp");
match fs::create_dir_all(&tmp) {
Ok(_) => {
fs::remove_file(tmp_file).unwrap();
fs::remove_dir_all(tmp).unwrap();
true
}
Err(e) => {