macfs -- Python library reference



Next: MacOS Prev: macdnr Up: Macintosh Specific Services Top: Top

14.6. Built-in Module macfs

This module provides access to macintosh FSSpec handling, the Alias Manager, finder aliases and the Standard File package.

Whenever a function or method expects a file argument, this argument can be one of three things: (1) a full or partial Macintosh pathname, (2) an FSSpec object or (3) a 3-tuple (wdRefNum, parID, name) as described in Inside Mac VI. and the standard file package can also be found there.

FSSpec (file) -- function of module macfs
Create an FSSpec object for the specified file.
RawFSSpec (data) -- function of module macfs
Create an FSSpec object given the raw data for the C structure for the FSSpec as a string. This is mainly useful if you have obtained an FSSpec structure over a network.
RawAlias (data) -- function of module macfs
Create an Alias object given the raw data for the C structure for the alias as a string. This is mainly useful if you have obtained an FSSpec structure over a network.
FInfo () -- function of module macfs
Create a zero-filled FInfo object.
ResolveAliasFile (file) -- function of module macfs
Resolve an alias file. Returns a 3-tuple (fsspec, isfolder, aliased) where fsspec is the resulting FSSpec object, isfolder is true if fsspec points to a folder and aliased is true if the file was an alias in the first place (otherwise the FSSpec object for the file itself is returned).
StandardGetFile ([type, ...]) -- function of module macfs
Present the user with a standard ``open input file'' dialog. Optionally, you can pass up to four 4-char file types to limit the files the user can choose from. The function returns an FSSpec object and a flag indicating that the user completed the dialog without cancelling.
PromptGetFile (prompt[, type, ...]) -- function of module macfs
Similar to StandardGetFile but allows you to specify a prompt.
StandardPutFile (prompt, [default]) -- function of module macfs
Present the user with a standard ``open output file'' dialog. prompt is the prompt string, and the optional default argument initializes the output file name. The function returns an FSSpec object and a flag indicating that the user completed the dialog without cancelling.
GetDirectory ([prompt]) -- function of module macfs
Present the user with a non-standard ``select a directory'' dialog. prompt is the prompt string, and the optional. Return an FSSpec object and a success-indicator.
FindFolder (where, which, create) -- function of module macfs
Locates one of the ``special'' folders that MacOS knows about, such as the trash or the Preferences folder. Where is the disk to search, which is the 4-char string specifying which folder to locate. Setting create causes the folder to be created if it does not exist. Returns a (vrefnum, dirid) tuple.

The constants for where and which can be obtained from the standard module MACFS.

Menu

FSSpec objects
alias objects
FInfo objects


Next: MacOS Prev: macdnr Up: Macintosh Specific Services Top: Top