Skip to content

mac_alias package

Classes

mac_alias.Alias(appinfo=b'\x00\x00\x00\x00', version=2, volume=None, target=None, extra=None)

Construct a new Alias object with the specified contents.

extra instance-attribute

A list of extra (tag, value) pairs

target instance-attribute

A TargetInfo object describing the target

version instance-attribute

Version (we support versions 2 and 3)

volume instance-attribute

A VolumeInfo object describing the target's volume

for_file(path) classmethod

Create an Alias that points at the specified file.

from_bytes(bytes) classmethod

Construct an Alias object given binary Alias data.

to_bytes()

Returns the binary representation for this Alias.

mac_alias.AppleShareInfo(zone=None, server=None, user=None)

server instance-attribute

The AFP server

user instance-attribute

The username

zone instance-attribute

The AppleShare zone

mac_alias.VolumeInfo(name, creation_date, fs_type, disk_type, attribute_flags, fs_id, appleshare_info=None, driver_name=None, posix_path=None, disk_image_alias=None, dialup_info=None, network_mount_info=None)

appleshare_info instance-attribute

AppleShare information (for automatic remounting of network shares) (optional)

attribute_flags instance-attribute

Filesystem attribute flags (from HFS volume header)

creation_date instance-attribute

The creation date of the target's volume

dialup_info instance-attribute

Dialup information (for automatic establishment of dialup connections)

disk_image_alias instance-attribute

Alias object pointing at the disk image on which the target's volume resides (optional)

disk_type instance-attribute

The type of disk; should be one of

  • ALIAS_FIXED_DISK
  • ALIAS_NETWORK_DISK
  • ALIAS_400KB_FLOPPY_DISK
  • ALIAS_800KB_FLOPPY_DISK
  • ALIAS_1_44MB_FLOPPY_DISK
  • ALIAS_EJECTABLE_DISK

driver_name instance-attribute

Driver name (probably contains a disk driver name on older Macs) (optional)

fs_id instance-attribute

Filesystem identifier

fs_type instance-attribute

The filesystem type (for v2 aliases, this is a 2-character code; for v3 aliases, a 4-character code).

name instance-attribute

The name of the volume on which the target resides

network_mount_info instance-attribute

Network mount information (for automatic remounting)

posix_path instance-attribute

POSIX path of the mount point of the target's volume (optional)

mac_alias.TargetInfo(kind, filename, folder_cnid, cnid, creation_date, creator_code, type_code, levels_from=-1, levels_to=-1, folder_name=None, cnid_path=None, carbon_path=None, posix_path=None, user_home_prefix_len=None)

carbon_path instance-attribute

The Carbon path of the target (optional)

cnid instance-attribute

The CNID (Catalog Node ID) of the target

cnid_path instance-attribute

The path from the volume root as a sequence of CNIDs. (optional)

creation_date instance-attribute

The target's creation date.

creator_code instance-attribute

The target's Mac creator code (a four-character binary string)

filename instance-attribute

The filename of the target

folder_cnid instance-attribute

The CNID (Catalog Node ID) of the target's containing folder; CNIDs are similar to but different than traditional UNIX inode numbers

folder_name instance-attribute

The (POSIX) name of the target's containing folder. (optional)

kind instance-attribute

Either ALIAS_KIND_FILE or ALIAS_KIND_FOLDER

levels_from instance-attribute

The depth of the alias? Always seems to be -1 on OS X.

levels_to instance-attribute

The depth of the target? Always seems to be -1 on OS X.

posix_path instance-attribute

The POSIX path of the target relative to the volume root. Note that this may or may not have a leading '/' character, but it is always relative to the containing volume. (optional)

type_code instance-attribute

The target's Mac type code (a four-character binary string)

user_home_prefix_len instance-attribute

If the path points into a user's home folder, the number of folders deep that we go before we get to that home folder. (optional)

mac_alias.Bookmark(tocs=None)

tocs instance-attribute

The TOCs for this Bookmark

for_file(path) classmethod

Construct a Bookmark for a given file.

from_bytes(data) classmethod

Create a Bookmark given byte data.

get(key, default=None)

Lookup the value for a given key, returning a default if not present.

to_bytes()

Convert this Bookmark to a byte representation.

mac_alias.Data(bytedata=None)

bytes instance-attribute

The bytes, stored as a byte string

mac_alias.URL(base, rel=None)

absolute property

Return an absolute URL.

base instance-attribute

The base URL, if any (a URL)

relative instance-attribute

The rest of the URL (a string)

Constants

ALIAS_KIND_FILE

ALIAS_KIND_FOLDER

Values for the TargetInfo.kind attribute.

ALIAS_HFS_VOLUME_SIGNATURE

The volume signature for HFS+.

ALIAS_FILESYSTEM_UDF

ALIAS_FILESYSTEM_FAT32

ALIAS_FILESYSTEM_EXFAT

ALIAS_FILESYSTEM_HFSX

ALIAS_FILESYSTEM_HFSPLUS

ALIAS_FILESYSTEM_FTP

ALIAS_FILESYSTEM_NTFS

ALIAS_FILESYSTEM_UNKNOWN

Values returned by the VolumeInfo.fs_type attribute.

ALIAS_FIXED_DISK

ALIAS_NETWORK_DISK

ALIAS_400KB_FLOPPY_DISK

ALIAS_800KB_FLOPPY_DISK

ALIAS_1_44MB_FLOPPY_DISK

ALIAS_EJECTABLE_DISK

Disk type constants.

ALIAS_NO_CNID

A constant used where no CNID is present.

kBookmarkURL

kBookmarkPath

kBookmarkCNIDPath

kBookmarkFileProperties

kBookmarkFileName

kBookmarkFileID

kBookmarkFileCreationDate

kBookmarkTOCPath

kBookmarkVolumePath

kBookmarkVolumeURL

kBookmarkVolumeName

kBookmarkVolumeUUID

kBookmarkVolumeSize

kBookmarkVolumeCreationDate

kBookmarkVolumeProperties

kBookmarkContainingFolder

kBookmarkUserName

kBookmarkUID

kBookmarkWasFileReference

kBookmarkCreationOptions

kBookmarkURLLengths

kBookmarkDisplayName

kBookmarkIconData

kBookmarkIconRef

kBookmarkTypeBindingData

kBookmarkCreationTime

kBookmarkSandboxRwExtension

kBookmarkSandboxRoExtension

kBookmarkAliasData

kBookmarkSecurityExtension

Bookmark data keys. A Bookmark holds a set of TOCs (Tables of Contents), each of which maps a set of keys to a set of values. The keys are either numeric, like the ones represented by the above constants, or strings.

Bookmarks can hold strings, byte data, numbers, dates, Booleans, arrays, dictionaries, UUIDs, URLs and NULLs (represented by Python None). If you store data in a bookmark using the string key functionality, the documentation for CFURL/NSURL recommends using reverse DNS for the keys to avoid clashes.