Documentation ¶
Overview ¶
The cocoa package reimplements some native Cocoa features in pure Go so Go programs running on Mac don't need to call into Cocoa. The goal of this project is not to replace or cover all Cocoa APIs but to facilitate the work of Gophers on Mac.
Index ¶
Constants ¶
const ( AliasKindFile = 0 AliasKindFolder = 1 )
const ( // Bookmark keys // = 0x1003 KBookmarkPath = 0x1004 // Array of path components KBookmarkCNIDPath = 0x1005 // Array of CNIDs KBookmarkFileProperties = 0x1010 // (CFURL rp flags, // CFURL rp flags asked for, // 8 bytes NULL) KBookmarkFileName = 0x1020 KBookmarkFileID = 0x1030 KBookmarkFileCreationDate = 0x1040 KBookmarkUnknown = 0x1054 // always 1? KBookmarkUnknown1 = 0x1055 // point to value in 0x1054 KBookmarkUnknown2 = 0x1056 // boolean, always true? // = 0x1101 // ? // = 0x1102 // ? KBookmarkTOCPath = 0x2000 // A list of (TOC id, ?) pairs KBookmarkVolumePath = 0x2002 KBookmarkVolumeURL = 0x2005 KBookmarkVolumeName = 0x2010 KBookmarkVolumeUUID = 0x2011 // Stored (perversely) as a string KBookmarkVolumeSize = 0x2012 KBookmarkVolumeCreationDate = 0x2013 KBookmarkVolumeProperties = 0x2020 KBookmarkVolumeIsRoot = 0x2030 // True if volume is FS root KBookmarkVolumeBookmark = 0x2040 // Embedded bookmark for disk image (TOC id) KBookmarkVolumeMountPoint = 0x2050 // A URL // = 0x2070 KBookmarkContainingFolder = 0xc001 // Index of containing folder in path KBookmarkUserName = 0xc011 // User that created bookmark KBookmarkUID = 0xc012 // UID that created bookmark KBookmarkWasFileReference = 0xd001 // True if the URL was a file reference KBookmarkCreationOptions = 0xd010 KBookmarkURLLengths = 0xe003 // See below KBookmarkFullFileName = 0xf017 KBookmarkFileType = 0xf022 // -> 0x201 looks like some file reference with file extension KBookmarkSecurityExtension = 0xf080 )
bookmarks flags
Variables ¶
var (
Debug bool
)
Functions ¶
Types ¶
type AliasRecord ¶
type AliasRecord struct { Path string CNIDPath []uint32 PathItems []string // Application specific four-character code AppCode [4]byte // Version (only 2 is supported) Version uint16 // Alias kind (0 = file, 1 = folder) Kind uint16 // Volume name (encoded as Pascal style) VolumeName string // Volume date (encoded as seconds since 1904-01-01 00:00:00 UTC) VolumeDate time.Time // Filesystem type (typically ‘H+’ for HFS+) FileSystem string // Disk type (0 = fixed, 1 = network, 2 = 400Kb, 3 = 800kb, 4 = 1.44MB, 5 = ejectable) DiskType uint16 // CNID of containing folder FolderCNID uint32 // Target name (encoded as Pascal-style string) TargetName string // Target CNID TargetCNID uint32 // Target creation date (encoded as seconds since 1904-01-01 00:00:00 UTC) TargetCreation time.Time // Target creator code (four-character code) TargetCreator [4]byte // Target type code (four-character code) TargetType [4]byte // Number of directory levels from alias to root (or -1) DirsAliasToRoot int16 // Number of directory levels from root to target (or -1) DirsRootToTarget int16 // Volume attributes VolumeAttributes [4]byte // Volume filesystem ID VolumeID uint16 }
AliasRecord is an alias representation that can be shared in memory For file persistency, see the Alias with bookmark data.
func NewAliasRecord ¶
func NewAliasRecord(path string) (*AliasRecord, error)
func (*AliasRecord) Encode ¶
func (a *AliasRecord) Encode() ([]byte, error)
Encode converts the AliasRecord into binary data and returns the byte data
type BookmarkData ¶
type BookmarkData struct { FileSystemType string Path []string // CNIDPath in the case of an alias file is the offset to the path element (minus header size) CNIDPath []uint64 FileCreationDate time.Time FileProperties []byte TypeData []byte // from 0xf022 ContainingFolderIDX uint32 VolumePath string VolumeIsRoot bool VolumeURL string // file://' + volPath VolumeName string VolumeSize int64 VolumeCreationDate time.Time VolumeUUID string // must be uppercase VolumeProperties []byte CreationOptions uint32 // 512 WasFileReference bool // true UserName string // unknown CNID uint32 UID uint32 // 99 Filename string }
BookmarkData represents the data structure holding the bookmark information
func AliasFromReader ¶
func AliasFromReader(r io.Reader) (*BookmarkData, error)
AliasFromReader takes an io.reader pointing to an alias file decodes it and returns the contained bookmark data.
func (*BookmarkData) String ¶
func (b *BookmarkData) String() string
func (*BookmarkData) TargetPath ¶
func (b *BookmarkData) TargetPath() string
TargetPath returns the full path to the current target url.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
daring is a package implementing low level features exposed in Cocoa but that can also be used directly in pure Go via syscalls.
|
daring is a package implementing low level features exposed in Cocoa but that can also be used directly in pure Go via syscalls. |