A couple of tweaks to handle AppleScript typeLongDateTime:
- unpackAsDate calls unpackAsInteger, which does not handle typeLongDateTime. Add to unpackAsInteger:
case typeLongDateTime:
result = T(exactly: Int64(bigEndian: try decodeFixedWidthValue(descriptor.data)))
or alternatively modify existing case:
case typeSInt64, typeLongDateTime:
result = T(exactly: Int64(bigEndian: try decodeFixedWidthValue(descriptor.data)))
-
now that unpackAsDate has computed the TimeInterval delta, fix a bug in the return statement, changing + to -:
return Date(timeIntervalSinceReferenceDate: delta - epochDelta)
-
test with a folder on the desktop:
let finder = Finder()
print(try finder.folders["TEMP"].creationDate.get())
- perhaps a better name for "delta" might be "secondsSince1904"?
A couple of tweaks to handle AppleScript typeLongDateTime:
or alternatively modify existing case:
now that unpackAsDate has computed the TimeInterval delta, fix a bug in the return statement, changing + to -:
return Date(timeIntervalSinceReferenceDate: delta - epochDelta)test with a folder on the desktop: