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
|
@ -399,34 +399,6 @@ impl DebugAdapter for CodeLldbDebugAdapter {
|
|||
};
|
||||
let adapter_dir = version_path.join("extension").join("adapter");
|
||||
let path = adapter_dir.join("codelldb").to_string_lossy().to_string();
|
||||
// todo("windows")
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
use smol::fs;
|
||||
|
||||
fs::set_permissions(
|
||||
&path,
|
||||
<fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
|
||||
)
|
||||
.await
|
||||
.with_context(|| format!("Settings executable permissions to {path:?}"))?;
|
||||
|
||||
let lldb_binaries_dir = version_path.join("extension").join("lldb").join("bin");
|
||||
let mut lldb_binaries =
|
||||
fs::read_dir(&lldb_binaries_dir).await.with_context(|| {
|
||||
format!("reading lldb binaries dir contents {lldb_binaries_dir:?}")
|
||||
})?;
|
||||
while let Some(binary) = lldb_binaries.next().await {
|
||||
let binary_entry = binary?;
|
||||
let path = binary_entry.path();
|
||||
fs::set_permissions(
|
||||
&path,
|
||||
<fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
|
||||
)
|
||||
.await
|
||||
.with_context(|| format!("Settings executable permissions to {path:?}"))?;
|
||||
}
|
||||
}
|
||||
self.path_to_codelldb.set(path.clone()).ok();
|
||||
command = Some(path);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue