Function std::old_io::fs::chmodUnstable
[-] [+]
[src]
pub fn chmod(path: &Path, mode: FilePermission) -> IoResult<()>
Changes the permission mode bits found on a file or a directory. This
function takes a mask from the io
module
Example
fn main() { #![allow(unused_must_use)] use std::old_io; use std::old_io::fs; fs::chmod(&Path::new("file.txt"), old_io::USER_FILE); fs::chmod(&Path::new("file.txt"), old_io::USER_READ | old_io::USER_WRITE); fs::chmod(&Path::new("dir"), old_io::USER_DIR); fs::chmod(&Path::new("file.exe"), old_io::USER_EXEC); }use std::old_io; use std::old_io::fs; fs::chmod(&Path::new("file.txt"), old_io::USER_FILE); fs::chmod(&Path::new("file.txt"), old_io::USER_READ | old_io::USER_WRITE); fs::chmod(&Path::new("dir"), old_io::USER_DIR); fs::chmod(&Path::new("file.exe"), old_io::USER_EXEC);
Error
This function will return an error if the provided path
doesn't exist, if
the process lacks permissions to change the attributes of the file, or if
some other I/O error is encountered.