Skip to content

typeLongDateTime suggested fix #5

@ronzo99

Description

@ronzo99

A couple of tweaks to handle AppleScript typeLongDateTime:

  1. 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)))
  1. now that unpackAsDate has computed the TimeInterval delta, fix a bug in the return statement, changing + to -:

    return Date(timeIntervalSinceReferenceDate: delta - epochDelta)

  2. test with a folder on the desktop:

let finder = Finder()
print(try finder.folders["TEMP"].creationDate.get())
  1. perhaps a better name for "delta" might be "secondsSince1904"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions