X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/3e20402491f013710dfa1c2f3d0cd6ab0e212585..71f9ce10c4d0ebc0d5aec5a2bf46b1c508409338:/hotline/file_wrapper.go?ds=sidebyside diff --git a/hotline/file_wrapper.go b/hotline/file_wrapper.go index 997325a..bc6319b 100644 --- a/hotline/file_wrapper.go +++ b/hotline/file_wrapper.go @@ -246,26 +246,23 @@ func (f *fileWrapper) flattenedFileObject() (*flattenedFileObject, error) { _, err = io.Copy(&f.ffo.FlatFileInformationFork, bytes.NewReader(b)) if err != nil { - return nil, err + return nil, fmt.Errorf("error copying FlatFileInformationFork: %w", err) } - } else { f.ffo.FlatFileInformationFork = FlatFileInformationFork{ - Platform: []byte("AMAC"), // TODO: Remove hardcode to support "AWIN" Platform (maybe?) - TypeSignature: []byte(ft.TypeCode), - CreatorSignature: []byte(ft.CreatorCode), - Flags: []byte{0, 0, 0, 0}, - PlatformFlags: []byte{0, 0, 1, 0}, // TODO: What is this? - RSVD: make([]byte, 32), - CreateDate: mTime[:], // some filesystems don't support createTime - ModifyDate: mTime[:], - NameScript: []byte{0, 0}, + Platform: [4]byte{0x41, 0x4D, 0x41, 0x43}, // "AMAC" TODO: Remove hardcode to support "AWIN" Platform (maybe?) + TypeSignature: [4]byte([]byte(ft.TypeCode)), + CreatorSignature: [4]byte([]byte(ft.CreatorCode)), + PlatformFlags: [4]byte{0, 0, 1, 0}, // TODO: What is this? + CreateDate: mTime, // some filesystems don't support createTime + ModifyDate: mTime, Name: []byte(f.name), - NameSize: []byte{0, 0}, - CommentSize: []byte{0, 0}, Comment: []byte{}, } - binary.BigEndian.PutUint16(f.ffo.FlatFileInformationFork.NameSize, uint16(len(f.name))) + + ns := make([]byte, 2) + binary.BigEndian.PutUint16(ns, uint16(len(f.name))) + f.ffo.FlatFileInformationFork.NameSize = [2]byte(ns[:]) } f.ffo.FlatFileInformationForkHeader = FlatFileForkHeader{