You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be a bug that is preventing the retrieval of the `creationDate` of a file when running on Windows. Assuming `zoo.txt` exists, the following is a minimal-ish reproduction of the issue. Given this code:
import Foundation
let workingDirectoryUrl = URL(fileURLWithPath: Bundle.main.resourcePath!)
let fileUrl = URL(fileURLWithPath: "zoo.txt", relativeTo: workingDirectoryUrl)
let fileAttributes = try! fileUrl.resourceValues(forKeys: [.nameKey, .creationDateKey])
let formatter = DateFormatter()
formatter.dateStyle = .short
formatter.timeStyle = .medium
let formattedName = fileAttributes.name ?? "unknown name"
let formattedDate = fileAttributes.creationDate.map { formatter.string(from: $0) }
?? "unknown date"
print("Found \(formattedName), created \(formattedDate)")
The output is `Found zoo.txt, created unknown date`.
Simply changing `creationDateKey` and `creationDate` to `contentModificationDateKey` and `contentModificationDate`, respectively, will yield an actual date.
The text was updated successfully, but these errors were encountered:
Environment
Windows 5.3-RELEASE
Windows 10 build: 18362.1082
Build tools version: MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27)
Windows SDK installed: 10.0.18362.0
Additional Detail from JIRA
md5: 9f34ab8d4d64f3ed7358d033104b9a65
Issue Description:
There appears to be a bug that is preventing the retrieval of the `creationDate` of a file when running on Windows. Assuming `zoo.txt` exists, the following is a minimal-ish reproduction of the issue. Given this code:
The output is `Found zoo.txt, created unknown date`.
Simply changing `creationDateKey` and `creationDate` to `contentModificationDateKey` and `contentModificationDate`, respectively, will yield an actual date.
The text was updated successfully, but these errors were encountered: