Keep file permissions when extracting zip archives on Unix (#31304)
Follow-up of https://github.com/zed-industries/zed/pull/31080 Stop doing ```rs #[cfg(not(windows))] { file.set_permissions(<fs::Permissions as fs::unix::PermissionsExt>::from_mode( 0o755, )) .await?; } ``` after extracting zip archives on Unix, and use an API that provides the file permissions data for each archive entry. Release Notes: - N/A
This commit is contained in:
parent
ca72efe701
commit
7341ab3980
10 changed files with 150 additions and 91 deletions
|
@ -442,11 +442,7 @@ impl LspAdapter for NodeVersionAdapter {
|
|||
.await
|
||||
.context("downloading release")?;
|
||||
if version.url.ends_with(".zip") {
|
||||
extract_zip(
|
||||
&destination_container_path,
|
||||
BufReader::new(response.body_mut()),
|
||||
)
|
||||
.await?;
|
||||
extract_zip(&destination_container_path, response.body_mut()).await?;
|
||||
} else if version.url.ends_with(".tar.gz") {
|
||||
let decompressed_bytes = GzipDecoder::new(BufReader::new(response.body_mut()));
|
||||
let archive = Archive::new(decompressed_bytes);
|
||||
|
@ -462,15 +458,6 @@ impl LspAdapter for NodeVersionAdapter {
|
|||
&destination_path,
|
||||
)
|
||||
.await?;
|
||||
// todo("windows")
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
fs::set_permissions(
|
||||
&destination_path,
|
||||
<fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
remove_matching(&container_dir, |entry| entry != destination_path).await;
|
||||
}
|
||||
Ok(LanguageServerBinary {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue