Fix mtime return so it is as per doc contract
This commit is contained in:
@@ -51,7 +51,7 @@ public extension Path {
|
|||||||
public var mtime: Date {
|
public var mtime: Date {
|
||||||
do {
|
do {
|
||||||
let attrs = try FileManager.default.attributesOfItem(atPath: string)
|
let attrs = try FileManager.default.attributesOfItem(atPath: string)
|
||||||
return attrs[.modificationDate] as? Date ?? attrs[.creationDate] as? Date ?? Date()
|
return attrs[.modificationDate] as? Date ?? attrs[.creationDate] as? Date ?? Date(timeIntervalSince1970: 0)
|
||||||
} catch {
|
} catch {
|
||||||
//TODO log error
|
//TODO log error
|
||||||
return Date(timeIntervalSince1970: 0)
|
return Date(timeIntervalSince1970: 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user