We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 27babdf commit a6cfa25Copy full SHA for a6cfa25
1 file changed
clang-installer/src/utils.rs
@@ -1,6 +1,6 @@
1
//! A utility module for path normalization.
2
use std::{
3
- fs::File,
+ fs::{self, File, OpenOptions},
4
path::{Component, Path, PathBuf},
5
};
6
@@ -47,7 +47,10 @@ pub fn normalize_path(path: &Path) -> PathBuf {
47
/// 2. deleting the file when done (if desired).
48
pub fn lock_path(path: &Path) -> Result<File, std::io::Error> {
49
let lock_path = path.with_added_extension("lock");
50
- let file_lock = std::fs::OpenOptions::new()
+ if let Some(parent) = lock_path.parent() {
51
+ fs::create_dir_all(parent)?;
52
+ }
53
+ let file_lock = OpenOptions::new()
54
.read(true)
55
.create(true)
56
.open(&lock_path)?;
0 commit comments