Skip to content

Commit d2c065b

Browse files
committed
changed time checking to where if you want the modified time it will not also check if the created time is ok so that even if the created time doesnt work on your system the other times will
1 parent db540c3 commit d2c065b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "natls"
3-
version = "2.1.8"
3+
version = "2.1.9"
44
authors = ["Will Lane <[email protected]>"]
55
description = "nat - the 'ls' replacement you never knew you needed"
66
license = "MIT"

src/utils/file_times.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub fn modified(file: std::path::PathBuf, format: String) -> String {
2-
if file.symlink_metadata().unwrap().modified().is_ok() && filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap()).is_some(){
2+
if file.symlink_metadata().unwrap().modified().is_ok() {
33
let naive = chrono::NaiveDateTime::from_timestamp(
44
filetime::FileTime::from_last_modification_time(&file.symlink_metadata().unwrap()).seconds()
55
as i64,
@@ -15,7 +15,7 @@ pub fn modified(file: std::path::PathBuf, format: String) -> String {
1515
}
1616

1717
pub fn created(file: std::path::PathBuf, format: String) -> String {
18-
if file.symlink_metadata().unwrap().created().is_ok() && filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap()).is_some() {
18+
if filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap()).is_some() {
1919
let naive = chrono::NaiveDateTime::from_timestamp(
2020
filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap())
2121
.unwrap()

0 commit comments

Comments
 (0)