Managed to start a VM again
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::Path;
|
||||
|
||||
const INVALID_CHARS: [&str; 19] = [
|
||||
@ -19,6 +20,14 @@ pub fn create_directory_if_missing<P: AsRef<Path>>(path: P) -> anyhow::Result<()
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update file permission
|
||||
pub fn set_file_permission<P: AsRef<Path>>(path: P, mode: u32) -> anyhow::Result<()> {
|
||||
let mut perms = std::fs::metadata(path.as_ref())?.permissions();
|
||||
perms.set_mode(mode);
|
||||
std::fs::set_permissions(path.as_ref(), perms)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::utils::files_utils::check_file_name;
|
||||
|
Reference in New Issue
Block a user