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 Macintosh: Files. A description of aliases and the
Standard File package can also be found there.
Note: A module, macfsn, is auto-imported to replace
StandardFile calls in macfs with NavServices calls.
Create an FSSpec object for the specified file.
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.
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.
Create a zero-filled FInfo object.
Resolve an alias file. Returns a 3-tuple
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
- StandardGetFile([type, ...])
Present the user with a standard ``open input file''
dialog. Optionally, you can pass up to four 4-character 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
- PromptGetFile(prompt[, type, ...])
Similar to StandardGetFile() but allows you to specify a
prompt which will be displayed at the top of the dialog.
- StandardPutFile(prompt[, default])
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.
Present the user with a non-standard ``select a directory'' dialog. You
have to first open the directory before clicking on the ``select current
directory'' button. prompt is the prompt string which will be
displayed at the top of the dialog. Return an FSSpec object and
Set the folder that is initially presented to the user when one of
the file selection dialogs is presented. fsspec should point to
a file in the folder, not the folder itself (the file need not exist,
though). If no argument is passed the folder will be set to the
current directory, i.e. what os.getcwd() returns.
Note that starting with system 7.5 the user can change Standard File
behaviour with the ``general controls'' control panel, thereby making
this call inoperative.
- FindFolder(where, which, create)
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-character string specifying which folder to
locate. Setting create causes the folder to be created if it
does not exist. Returns a
(vrefnum, dirid) tuple.
Return a minimal alias object that points to the given file, which
must be specified as a full pathname. This is the only way to create an
Alias pointing to a non-existing file.
The constants for where and which can be obtained from the
standard module MACFS.
Locate the application with 4-character creator code creator. The
function returns an FSSpec object pointing to the application.
See About this document... for information on suggesting changes.