cargo_setupx/utils/
make_executable.rs

1//! File permission utilities
2
3use crate::error::Result;
4use std::fs;
5use std::path::Path;
6
7/// Make a file executable (Unix only)
8#[cfg(unix)]
9pub fn make_executable(path: &Path) -> Result<()> {
10    use std::os::unix::fs::PermissionsExt;
11    let mut perms = fs::metadata(path)?.permissions();
12    perms.set_mode(0o755);
13    fs::set_permissions(path, perms)?;
14    Ok(())
15}
16
17/// Make a file executable (Windows no-op)
18#[cfg(not(unix))]
19pub fn make_executable(_path: &Path) -> Result<()> {
20    Ok(())
21}