mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge pull request #18693 from Veykril/push-wzoomkkmuolm
fix: Fix proc-macro dylib names on windows
This commit is contained in:
commit
27e824fad4
1 changed files with 3 additions and 6 deletions
|
@ -199,18 +199,15 @@ fn ensure_file_with_lock_free_access(path: &Utf8Path) -> io::Result<Utf8PathBuf>
|
||||||
to.push("rust-analyzer-proc-macros");
|
to.push("rust-analyzer-proc-macros");
|
||||||
_ = fs::create_dir(&to);
|
_ = fs::create_dir(&to);
|
||||||
|
|
||||||
let file_name = path.file_name().ok_or_else(|| {
|
let file_name = path.file_stem().ok_or_else(|| {
|
||||||
io::Error::new(io::ErrorKind::InvalidInput, format!("File path is invalid: {path}"))
|
io::Error::new(io::ErrorKind::InvalidInput, format!("File path is invalid: {path}"))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
to.push({
|
to.push({
|
||||||
// Generate a unique number by abusing `HashMap`'s hasher.
|
// Generate a unique number by abusing `HashMap`'s hasher.
|
||||||
// Maybe this will also "inspire" a libs team member to finally put `rand` in libstd.
|
// Maybe this will also "inspire" a libs team member to finally put `rand` in libstd.
|
||||||
let t = RandomState::new().build_hasher().finish();
|
let unique_name = RandomState::new().build_hasher().finish();
|
||||||
let mut unique_name = t.to_string();
|
format!("{file_name}-{unique_name}.dll")
|
||||||
unique_name.push_str(file_name);
|
|
||||||
unique_name.push('-');
|
|
||||||
unique_name
|
|
||||||
});
|
});
|
||||||
fs::copy(path, &to)?;
|
fs::copy(path, &to)?;
|
||||||
Ok(to)
|
Ok(to)
|
||||||
|
|
Loading…
Reference in a new issue