Skip to content

Commit

Permalink
chore: fix warnings on win32
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Feb 29, 2024
1 parent e97d7d3 commit f8aba29
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub async fn is_executable(path: impl AsRef<Path>) -> Result<bool> {
meta.permissions().mode() & 0o100 != 0
};
#[cfg(not(unix))]
let has_executable_flag = |meta: Metadata| true;
let has_executable_flag = |_meta: Metadata| true;

fs::metadata(path.as_ref())
.await
Expand Down
24 changes: 16 additions & 8 deletions src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,21 +631,29 @@ mod archive {
}

/// Set the executable flag for a file. Only has an effect on UNIX platforms.
#[cfg(not(unix))]
fn set_file_permissions(
_file: &mut File,
_mode: u32,
_file_path_hint: impl Display,
) -> Result<()> {
Ok(())
}

/// Set the executable flag for a file. Only has an effect on UNIX platforms.
#[cfg(unix)]
fn set_file_permissions(
file: &mut File,
mode: u32,
file_path_hint: impl Display,
) -> Result<()> {
#[cfg(unix)]
{
use std::fs::Permissions;
use std::os::unix::fs::PermissionsExt;
use std::fs::Permissions;
use std::os::unix::fs::PermissionsExt;

tracing::debug!("Setting permission of '{file_path_hint}' to {mode:#o}");
tracing::debug!("Setting permission of '{file_path_hint}' to {mode:#o}");

file.set_permissions(Permissions::from_mode(mode))
.context("failed setting file permissions")?;
}
file.set_permissions(Permissions::from_mode(mode))
.context("failed setting file permissions")?;

Ok(())
}
Expand Down

0 comments on commit f8aba29

Please sign in to comment.