mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Removed unused readonly attribute for FsEntry
This commit is contained in:
@@ -92,7 +92,6 @@ impl FtpFileTransfer {
|
|||||||
last_access_time: x.modified(),
|
last_access_time: x.modified(),
|
||||||
last_change_time: x.modified(),
|
last_change_time: x.modified(),
|
||||||
creation_time: x.modified(),
|
creation_time: x.modified(),
|
||||||
readonly: false,
|
|
||||||
symlink: None,
|
symlink: None,
|
||||||
user: x.uid(),
|
user: x.uid(),
|
||||||
group: x.gid(),
|
group: x.gid(),
|
||||||
@@ -107,7 +106,6 @@ impl FtpFileTransfer {
|
|||||||
last_access_time: x.modified(),
|
last_access_time: x.modified(),
|
||||||
last_change_time: x.modified(),
|
last_change_time: x.modified(),
|
||||||
creation_time: x.modified(),
|
creation_time: x.modified(),
|
||||||
readonly: false,
|
|
||||||
user: x.uid(),
|
user: x.uid(),
|
||||||
group: x.gid(),
|
group: x.gid(),
|
||||||
symlink: Self::get_symlink_entry(path, x.symlink()),
|
symlink: Self::get_symlink_entry(path, x.symlink()),
|
||||||
@@ -149,7 +147,6 @@ impl FtpFileTransfer {
|
|||||||
creation_time: UNIX_EPOCH,
|
creation_time: UNIX_EPOCH,
|
||||||
user: None,
|
user: None,
|
||||||
group: None,
|
group: None,
|
||||||
readonly: false,
|
|
||||||
symlink: None,
|
symlink: None,
|
||||||
unix_pex: None,
|
unix_pex: None,
|
||||||
abs_path,
|
abs_path,
|
||||||
@@ -775,11 +772,10 @@ mod tests {
|
|||||||
creation_time: UNIX_EPOCH,
|
creation_time: UNIX_EPOCH,
|
||||||
size: 0,
|
size: 0,
|
||||||
ftype: Some(String::from("txt")), // File type
|
ftype: Some(String::from("txt")), // File type
|
||||||
readonly: true,
|
symlink: None, // UNIX only
|
||||||
symlink: None, // UNIX only
|
user: Some(0), // UNIX only
|
||||||
user: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
|
||||||
});
|
});
|
||||||
assert!(ftp
|
assert!(ftp
|
||||||
.rename(&dummy, PathBuf::from("/a/b/c").as_path())
|
.rename(&dummy, PathBuf::from("/a/b/c").as_path())
|
||||||
@@ -931,11 +927,10 @@ mod tests {
|
|||||||
creation_time: UNIX_EPOCH,
|
creation_time: UNIX_EPOCH,
|
||||||
size: 0,
|
size: 0,
|
||||||
ftype: Some(String::from("txt")), // File type
|
ftype: Some(String::from("txt")), // File type
|
||||||
readonly: true,
|
symlink: None, // UNIX only
|
||||||
symlink: None, // UNIX only
|
user: Some(0), // UNIX only
|
||||||
user: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
|
||||||
};
|
};
|
||||||
let mut ftp: FtpFileTransfer = FtpFileTransfer::new(false);
|
let mut ftp: FtpFileTransfer = FtpFileTransfer::new(false);
|
||||||
assert!(ftp.change_dir(Path::new("/tmp")).is_err());
|
assert!(ftp.change_dir(Path::new("/tmp")).is_err());
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ impl ScpFileTransfer {
|
|||||||
last_change_time: mtime,
|
last_change_time: mtime,
|
||||||
last_access_time: mtime,
|
last_access_time: mtime,
|
||||||
creation_time: mtime,
|
creation_time: mtime,
|
||||||
readonly: false,
|
|
||||||
symlink,
|
symlink,
|
||||||
user: uid,
|
user: uid,
|
||||||
group: gid,
|
group: gid,
|
||||||
@@ -232,7 +231,6 @@ impl ScpFileTransfer {
|
|||||||
creation_time: mtime,
|
creation_time: mtime,
|
||||||
size: filesize,
|
size: filesize,
|
||||||
ftype: extension,
|
ftype: extension,
|
||||||
readonly: false,
|
|
||||||
symlink,
|
symlink,
|
||||||
user: uid,
|
user: uid,
|
||||||
group: gid,
|
group: gid,
|
||||||
@@ -1125,11 +1123,10 @@ mod tests {
|
|||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
size: 0,
|
size: 0,
|
||||||
ftype: Some(String::from("txt")), // File type
|
ftype: Some(String::from("txt")), // File type
|
||||||
readonly: true,
|
symlink: None, // UNIX only
|
||||||
symlink: None, // UNIX only
|
user: Some(0), // UNIX only
|
||||||
user: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
|
||||||
});
|
});
|
||||||
assert!(client
|
assert!(client
|
||||||
.rename(&dummy, PathBuf::from("/a/b/c").as_path())
|
.rename(&dummy, PathBuf::from("/a/b/c").as_path())
|
||||||
@@ -1244,7 +1241,6 @@ mod tests {
|
|||||||
assert_eq!(entry.abs_path, PathBuf::from("/tmp/Cargo.toml"));
|
assert_eq!(entry.abs_path, PathBuf::from("/tmp/Cargo.toml"));
|
||||||
assert_eq!(entry.unix_pex.unwrap(), (6, 4, 4));
|
assert_eq!(entry.unix_pex.unwrap(), (6, 4, 4));
|
||||||
assert_eq!(entry.size, 2056);
|
assert_eq!(entry.size, 2056);
|
||||||
assert_eq!(entry.readonly, false);
|
|
||||||
assert_eq!(entry.ftype.unwrap().as_str(), "toml");
|
assert_eq!(entry.ftype.unwrap().as_str(), "toml");
|
||||||
assert!(entry.symlink.is_none());
|
assert!(entry.symlink.is_none());
|
||||||
// File (year)
|
// File (year)
|
||||||
@@ -1260,7 +1256,6 @@ mod tests {
|
|||||||
assert_eq!(entry.abs_path, PathBuf::from("/tmp/CODE_OF_CONDUCT.md"));
|
assert_eq!(entry.abs_path, PathBuf::from("/tmp/CODE_OF_CONDUCT.md"));
|
||||||
assert_eq!(entry.unix_pex.unwrap(), (6, 6, 6));
|
assert_eq!(entry.unix_pex.unwrap(), (6, 6, 6));
|
||||||
assert_eq!(entry.size, 3368);
|
assert_eq!(entry.size, 3368);
|
||||||
assert_eq!(entry.readonly, false);
|
|
||||||
assert_eq!(entry.ftype.unwrap().as_str(), "md");
|
assert_eq!(entry.ftype.unwrap().as_str(), "md");
|
||||||
assert!(entry.symlink.is_none());
|
assert!(entry.symlink.is_none());
|
||||||
// Directory
|
// Directory
|
||||||
@@ -1275,7 +1270,6 @@ mod tests {
|
|||||||
assert_eq!(entry.name.as_str(), "docs");
|
assert_eq!(entry.name.as_str(), "docs");
|
||||||
assert_eq!(entry.abs_path, PathBuf::from("/tmp/docs"));
|
assert_eq!(entry.abs_path, PathBuf::from("/tmp/docs"));
|
||||||
assert_eq!(entry.unix_pex.unwrap(), (7, 5, 5));
|
assert_eq!(entry.unix_pex.unwrap(), (7, 5, 5));
|
||||||
assert_eq!(entry.readonly, false);
|
|
||||||
assert!(entry.symlink.is_none());
|
assert!(entry.symlink.is_none());
|
||||||
// Short metadata
|
// Short metadata
|
||||||
assert!(client
|
assert!(client
|
||||||
@@ -1323,11 +1317,10 @@ mod tests {
|
|||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
size: 0,
|
size: 0,
|
||||||
ftype: Some(String::from("txt")), // File type
|
ftype: Some(String::from("txt")), // File type
|
||||||
readonly: true,
|
symlink: None, // UNIX only
|
||||||
symlink: None, // UNIX only
|
user: Some(0), // UNIX only
|
||||||
user: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
|
||||||
};
|
};
|
||||||
let mut scp: ScpFileTransfer = ScpFileTransfer::new(SshKeyStorage::empty());
|
let mut scp: ScpFileTransfer = ScpFileTransfer::new(SshKeyStorage::empty());
|
||||||
assert!(scp.change_dir(Path::new("/tmp")).is_err());
|
assert!(scp.change_dir(Path::new("/tmp")).is_err());
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ impl SftpFileTransfer {
|
|||||||
last_change_time: mtime,
|
last_change_time: mtime,
|
||||||
last_access_time: atime,
|
last_access_time: atime,
|
||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
readonly: false,
|
|
||||||
symlink,
|
symlink,
|
||||||
user: uid,
|
user: uid,
|
||||||
group: gid,
|
group: gid,
|
||||||
@@ -192,7 +191,6 @@ impl SftpFileTransfer {
|
|||||||
last_change_time: mtime,
|
last_change_time: mtime,
|
||||||
last_access_time: atime,
|
last_access_time: atime,
|
||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
readonly: false,
|
|
||||||
symlink,
|
symlink,
|
||||||
user: uid,
|
user: uid,
|
||||||
group: gid,
|
group: gid,
|
||||||
@@ -923,11 +921,10 @@ mod tests {
|
|||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
size: 0,
|
size: 0,
|
||||||
ftype: Some(String::from("txt")), // File type
|
ftype: Some(String::from("txt")), // File type
|
||||||
readonly: true,
|
symlink: None, // UNIX only
|
||||||
symlink: None, // UNIX only
|
user: Some(0), // UNIX only
|
||||||
user: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
|
||||||
});
|
});
|
||||||
assert!(client
|
assert!(client
|
||||||
.rename(&dummy, PathBuf::from("/a/b/c").as_path())
|
.rename(&dummy, PathBuf::from("/a/b/c").as_path())
|
||||||
@@ -1072,11 +1069,10 @@ mod tests {
|
|||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
size: 0,
|
size: 0,
|
||||||
ftype: Some(String::from("txt")), // File type
|
ftype: Some(String::from("txt")), // File type
|
||||||
readonly: true,
|
symlink: None, // UNIX only
|
||||||
symlink: None, // UNIX only
|
user: Some(0), // UNIX only
|
||||||
user: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
|
||||||
};
|
};
|
||||||
let mut sftp: SftpFileTransfer = SftpFileTransfer::new(SshKeyStorage::empty());
|
let mut sftp: SftpFileTransfer = SftpFileTransfer::new(SshKeyStorage::empty());
|
||||||
assert!(sftp.change_dir(Path::new("/tmp")).is_err());
|
assert!(sftp.change_dir(Path::new("/tmp")).is_err());
|
||||||
|
|||||||
@@ -552,7 +552,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -593,7 +592,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -624,7 +622,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -655,7 +652,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -686,7 +682,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
@@ -723,7 +718,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -752,7 +746,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -789,7 +782,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
@@ -802,7 +794,6 @@ mod tests {
|
|||||||
last_change_time: t,
|
last_change_time: t,
|
||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
readonly: false,
|
|
||||||
symlink: Some(Box::new(pointer)), // UNIX only
|
symlink: Some(Box::new(pointer)), // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
group: None, // UNIX only
|
group: None, // UNIX only
|
||||||
@@ -821,7 +812,6 @@ mod tests {
|
|||||||
last_change_time: t,
|
last_change_time: t,
|
||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
group: None, // UNIX only
|
group: None, // UNIX only
|
||||||
@@ -841,7 +831,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
@@ -855,7 +844,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: Some(Box::new(pointer)), // UNIX only
|
symlink: Some(Box::new(pointer)), // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
@@ -876,7 +864,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: None, // UNIX only
|
user: None, // UNIX only
|
||||||
|
|||||||
@@ -586,7 +586,6 @@ mod tests {
|
|||||||
last_access_time: t,
|
last_access_time: t,
|
||||||
creation_time: t,
|
creation_time: t,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -670,8 +669,7 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 64,
|
size: 64,
|
||||||
ftype: None, // File type
|
ftype: None, // File type
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -683,7 +681,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -702,8 +699,7 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: size,
|
size: size,
|
||||||
ftype: None, // File type
|
ftype: None, // File type
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -715,7 +711,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ pub struct FsDirectory {
|
|||||||
pub last_change_time: SystemTime,
|
pub last_change_time: SystemTime,
|
||||||
pub last_access_time: SystemTime,
|
pub last_access_time: SystemTime,
|
||||||
pub creation_time: SystemTime,
|
pub creation_time: SystemTime,
|
||||||
pub readonly: bool,
|
|
||||||
pub symlink: Option<Box<FsEntry>>, // UNIX only
|
pub symlink: Option<Box<FsEntry>>, // UNIX only
|
||||||
pub user: Option<u32>, // UNIX only
|
pub user: Option<u32>, // UNIX only
|
||||||
pub group: Option<u32>, // UNIX only
|
pub group: Option<u32>, // UNIX only
|
||||||
@@ -71,8 +70,7 @@ pub struct FsFile {
|
|||||||
pub last_access_time: SystemTime,
|
pub last_access_time: SystemTime,
|
||||||
pub creation_time: SystemTime,
|
pub creation_time: SystemTime,
|
||||||
pub size: usize,
|
pub size: usize,
|
||||||
pub ftype: Option<String>, // File type
|
pub ftype: Option<String>, // File type
|
||||||
pub readonly: bool,
|
|
||||||
pub symlink: Option<Box<FsEntry>>, // UNIX only
|
pub symlink: Option<Box<FsEntry>>, // UNIX only
|
||||||
pub user: Option<u32>, // UNIX only
|
pub user: Option<u32>, // UNIX only
|
||||||
pub group: Option<u32>, // UNIX only
|
pub group: Option<u32>, // UNIX only
|
||||||
@@ -264,7 +262,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -296,7 +293,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -330,7 +326,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -350,7 +345,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -369,7 +363,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -384,7 +377,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -398,7 +390,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -418,7 +409,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8192,
|
size: 8192,
|
||||||
readonly: false,
|
|
||||||
ftype: Some(String::from("txt")),
|
ftype: Some(String::from("txt")),
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
@@ -437,7 +427,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -457,7 +446,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -469,7 +457,6 @@ mod tests {
|
|||||||
last_change_time: t_now,
|
last_change_time: t_now,
|
||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
readonly: false,
|
|
||||||
symlink: Some(Box::new(entry_target)),
|
symlink: Some(Box::new(entry_target)),
|
||||||
user: Some(0),
|
user: Some(0),
|
||||||
group: Some(0),
|
group: Some(0),
|
||||||
@@ -482,7 +469,6 @@ mod tests {
|
|||||||
last_access_time: t_now,
|
last_access_time: t_now,
|
||||||
creation_time: t_now,
|
creation_time: t_now,
|
||||||
size: 8,
|
size: 8,
|
||||||
readonly: false,
|
|
||||||
ftype: None,
|
ftype: None,
|
||||||
symlink: Some(Box::new(entry_child)),
|
symlink: Some(Box::new(entry_child)),
|
||||||
user: Some(0),
|
user: Some(0),
|
||||||
|
|||||||
@@ -461,7 +461,6 @@ impl Localhost {
|
|||||||
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
readonly: attr.permissions().readonly(),
|
|
||||||
symlink: match fs::read_link(path.as_path()) {
|
symlink: match fs::read_link(path.as_path()) {
|
||||||
Ok(p) => match self.stat(p.as_path()) {
|
Ok(p) => match self.stat(p.as_path()) {
|
||||||
Ok(entry) => Some(Box::new(entry)),
|
Ok(entry) => Some(Box::new(entry)),
|
||||||
@@ -484,7 +483,6 @@ impl Localhost {
|
|||||||
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
readonly: attr.permissions().readonly(),
|
|
||||||
size: attr.len() as usize,
|
size: attr.len() as usize,
|
||||||
ftype: extension,
|
ftype: extension,
|
||||||
symlink: match fs::read_link(path.as_path()) {
|
symlink: match fs::read_link(path.as_path()) {
|
||||||
@@ -506,7 +504,6 @@ impl Localhost {
|
|||||||
///
|
///
|
||||||
/// Stat file and create a FsEntry
|
/// Stat file and create a FsEntry
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub fn stat(&self, path: &Path) -> Result<FsEntry, HostError> {
|
pub fn stat(&self, path: &Path) -> Result<FsEntry, HostError> {
|
||||||
let path: PathBuf = self.to_abs_path(path);
|
let path: PathBuf = self.to_abs_path(path);
|
||||||
info!("Stating file {}", path.display());
|
info!("Stating file {}", path.display());
|
||||||
@@ -530,7 +527,6 @@ impl Localhost {
|
|||||||
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
readonly: attr.permissions().readonly(),
|
|
||||||
symlink: match fs::read_link(path.as_path()) {
|
symlink: match fs::read_link(path.as_path()) {
|
||||||
Ok(p) => match self.stat(p.as_path()) {
|
Ok(p) => match self.stat(p.as_path()) {
|
||||||
Ok(entry) => Some(Box::new(entry)),
|
Ok(entry) => Some(Box::new(entry)),
|
||||||
@@ -554,7 +550,6 @@ impl Localhost {
|
|||||||
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_change_time: attr.modified().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
last_access_time: attr.accessed().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
creation_time: attr.created().unwrap_or(SystemTime::UNIX_EPOCH),
|
||||||
readonly: attr.permissions().readonly(),
|
|
||||||
size: attr.len() as usize,
|
size: attr.len() as usize,
|
||||||
ftype: extension,
|
ftype: extension,
|
||||||
symlink: match fs::read_link(path.as_path()) {
|
symlink: match fs::read_link(path.as_path()) {
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ pub fn create_sample_file_entry() -> (FsFile, NamedTempFile) {
|
|||||||
last_access_time: SystemTime::UNIX_EPOCH,
|
last_access_time: SystemTime::UNIX_EPOCH,
|
||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
size: 127,
|
size: 127,
|
||||||
ftype: None, // File type
|
ftype: None, // File type
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -162,7 +161,6 @@ pub fn make_fsentry(path: PathBuf, is_dir: bool) -> FsEntry {
|
|||||||
last_change_time: SystemTime::UNIX_EPOCH,
|
last_change_time: SystemTime::UNIX_EPOCH,
|
||||||
last_access_time: SystemTime::UNIX_EPOCH,
|
last_access_time: SystemTime::UNIX_EPOCH,
|
||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -175,8 +173,7 @@ pub fn make_fsentry(path: PathBuf, is_dir: bool) -> FsEntry {
|
|||||||
last_access_time: SystemTime::UNIX_EPOCH,
|
last_access_time: SystemTime::UNIX_EPOCH,
|
||||||
creation_time: SystemTime::UNIX_EPOCH,
|
creation_time: SystemTime::UNIX_EPOCH,
|
||||||
size: 127,
|
size: 127,
|
||||||
ftype: None, // File type
|
ftype: None, // File type
|
||||||
readonly: false,
|
|
||||||
symlink: None, // UNIX only
|
symlink: None, // UNIX only
|
||||||
user: Some(0), // UNIX only
|
user: Some(0), // UNIX only
|
||||||
group: Some(0), // UNIX only
|
group: Some(0), // UNIX only
|
||||||
@@ -200,7 +197,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_utils_test_helpers_sample_file() {
|
fn test_utils_test_helpers_sample_file() {
|
||||||
let (file, _) = create_sample_file_entry();
|
let (file, _) = create_sample_file_entry();
|
||||||
assert_eq!(file.readonly, false);
|
assert!(file.symlink.is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user