Skip to content

Commit

Permalink
use new filemetadata format;
Browse files Browse the repository at this point in the history
  • Loading branch information
ph0llux committed Jul 28, 2024
1 parent 9db24a8 commit 49a3539
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,17 @@ fn file_attr_of_file<R: Read + Seek>(mut filemetadata: FileMetadata, zffreader:
let filetype = convert_filetype(&zff_filetype, zffreader)?;

let atime = match filemetadata.metadata_ext.get(ATIME) {
Some(atime) => atime.parse::<i64>()?,
Some(atime) => if let Some(atime) = atime.as_any().downcast_ref::<u64>() {
*atime as i64
} else {
0
},
None => match zffreader.current_fileheader()?.metadata_ext.get(ATIME) {
Some(atime) => atime.parse::<i64>()?,
Some(atime) => if let Some(atime) = atime.as_any().downcast_ref::<u64>() {
*atime as i64
} else {
0
},
None => 0
}
};
Expand All @@ -849,9 +857,17 @@ fn file_attr_of_file<R: Read + Seek>(mut filemetadata: FileMetadata, zffreader:
};

let mtime = match filemetadata.metadata_ext.get(MTIME) {
Some(mtime) => mtime.parse::<i64>()?,
Some(mtime) => if let Some(mtime) = mtime.as_any().downcast_ref::<u64>() {
*mtime as i64
} else {
0
},
None => match zffreader.current_fileheader()?.metadata_ext.get(MTIME) {
Some(mtime) => mtime.parse::<i64>()?,
Some(mtime) => if let Some(mtime) = mtime.as_any().downcast_ref::<u64>() {
*mtime as i64
} else {
0
},
None => 0
}
};
Expand All @@ -861,9 +877,17 @@ fn file_attr_of_file<R: Read + Seek>(mut filemetadata: FileMetadata, zffreader:
};

let ctime = match filemetadata.metadata_ext.get(CTIME) {
Some(ctime) => ctime.parse::<i64>()?,
Some(ctime) => if let Some(ctime) = ctime.as_any().downcast_ref::<u64>() {
*ctime as i64
} else {
0
},
None => match zffreader.current_fileheader()?.metadata_ext.get(CTIME) {
Some(ctime) => ctime.parse::<i64>()?,
Some(ctime) => if let Some(ctime) = ctime.as_any().downcast_ref::<u64>() {
*ctime as i64
} else {
0
},
None => 0
}
};
Expand All @@ -873,9 +897,17 @@ fn file_attr_of_file<R: Read + Seek>(mut filemetadata: FileMetadata, zffreader:
};

let btime = match filemetadata.metadata_ext.get(BTIME) {
Some(btime) => btime.parse::<i64>()?,
Some(btime) => if let Some(btime) = btime.as_any().downcast_ref::<u64>() {
*btime as i64
} else {
0
},
None => match zffreader.current_fileheader()?.metadata_ext.get(BTIME) {
Some(btime) => btime.parse::<i64>()?,
Some(btime) => if let Some(btime) = btime.as_any().downcast_ref::<u64>() {
*btime as i64
} else {
0
},
None => 0
}
};
Expand Down

0 comments on commit 49a3539

Please sign in to comment.