cli fix
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use crate::xx::*;
|
||||
use crate::*;
|
||||
use core::fmt;
|
||||
mod tools;
|
||||
|
||||
|
@@ -205,8 +205,8 @@ cfg_if::cfg_if! {
|
||||
Ok(())
|
||||
}
|
||||
} else if #[cfg(windows)] {
|
||||
use std::os::windows::fs::MetadataExt;
|
||||
use windows_permissions::*;
|
||||
//use std::os::windows::fs::MetadataExt;
|
||||
//use windows_permissions::*;
|
||||
|
||||
pub fn ensure_file_private_owner<P:AsRef<Path>>(path: P) -> Result<(),String>
|
||||
{
|
||||
@@ -217,11 +217,11 @@ cfg_if::cfg_if! {
|
||||
|
||||
// let uid = Uid::effective();
|
||||
// let gid = Gid::effective();
|
||||
let meta = std::fs::metadata(path).map_err(|e| format!("unable to get metadata for path '{:?}': {}",path, e))?;
|
||||
//let meta = std::fs::metadata(path).map_err(|e| format!("unable to get metadata for path '{:?}': {}",path, e))?;
|
||||
|
||||
if meta.mode() != 0o600 {
|
||||
std::fs::set_permissions(path,std::fs::Permissions::from_mode(0o600)).map_err(|e| format!("unable to set correct permissions on path '{:?}': {}", path, e))?;
|
||||
}
|
||||
//if meta.mode() != 0o600 {
|
||||
// std::fs::set_permissions(path,std::fs::Permissions::from_mode(0o600)).map_err(|e| format!("unable to set correct permissions on path '{:?}': {}", path, e))?;
|
||||
//}
|
||||
|
||||
//if meta.uid() != uid.as_raw() || meta.gid() != gid.as_raw() {
|
||||
// chown(path, Some(uid), Some(gid)).map_err(|e| format!("unable to set correct owner on path '{:?}': {}", path, e))?;
|
||||
|
Reference in New Issue
Block a user