1 \section{Built-in Module
\sectcode{macfs
}}
4 \renewcommand{\indexsubitem}{(in module macfs)
}
6 This module provides access to macintosh FSSpec handling, the Alias
7 Manager, finder aliases and the Standard File package.
9 Whenever a function or method expects a
\var{file
} argument, this
10 argument can be one of three things:\ (
1) a full or partial Macintosh
11 pathname, (
2) an FSSpec object or (
3) a
3-tuple
\code{(wdRefNum,
12 parID, name)
} as described in Inside Mac VI\@. A description of aliases
13 and the standard file package can also be found there.
15 \begin{funcdesc
}{FSSpec
}{file
}
16 Create an FSSpec object for the specified file.
19 \begin{funcdesc
}{RawFSSpec
}{data
}
20 Create an FSSpec object given the raw data for the C structure for the
21 FSSpec as a string. This is mainly useful if you have obtained an
22 FSSpec structure over a network.
25 \begin{funcdesc
}{RawAlias
}{data
}
26 Create an Alias object given the raw data for the C structure for the
27 alias as a string. This is mainly useful if you have obtained an
28 FSSpec structure over a network.
31 \begin{funcdesc
}{FInfo
}{}
32 Create a zero-filled FInfo object.
35 \begin{funcdesc
}{ResolveAliasFile
}{file
}
36 Resolve an alias file. Returns a
3-tuple
\code{(
\var{fsspec
},
\var{isfolder
},
37 \var{aliased
})
} where
\var{fsspec
} is the resulting FSSpec object,
38 \var{isfolder
} is true if
\var{fsspec
} points to a folder and
39 \var{aliased
} is true if the file was an alias in the first place
40 (otherwise the FSSpec object for the file itself is returned).
43 \begin{funcdesc
}{StandardGetFile
}{\optional{type\, ...
}}
44 Present the user with a standard ``open input file''
45 dialog. Optionally, you can pass up to four
4-char file types to limit
46 the files the user can choose from. The function returns an FSSpec
47 object and a flag indicating that the user completed the dialog
51 \begin{funcdesc
}{StandardPutFile
}{prompt\,
\optional{default
}}
52 Present the user with a standard ``open output file''
53 dialog.
\var{prompt
} is the prompt string, and the optional
54 \var{default
} argument initializes the output file name. The function
55 returns an FSSpec object and a flag indicating that the user completed
56 the dialog without cancelling.
59 \begin{funcdesc
}{GetDirectory
}{}
60 Present the user with a non-standard ``select a directory''
61 dialog. Return an FSSpec object and a success-indicator.
64 \begin{funcdesc
}{FindFolder
}{where\, which\, create
}
65 Locates one of the ``special'' folders that MacOS knows about, such as
66 the trash or the Preferences folder.
\var{Where
} is the disk to search
67 (
\code{0x8000} for the boot disk),
\var{which
} is the
4-char string
68 specifying which folder to locate. Setting
\var{create
} causes the
69 folder to be created if it does not exist. Returns a
\code{(vrefnum,
70 dirid)
} tuple. See Inside Mac VI for a complete description, including
74 \subsection{FSSpec objects
}
76 \renewcommand{\indexsubitem}{(FSSpec object attribute)
}
77 \begin{datadesc
}{data
}
78 The raw data from the FSSpec object, suitable for passing
79 to other applications, for instance.
82 \renewcommand{\indexsubitem}{(FSSpec object method)
}
83 \begin{funcdesc
}{as_pathname
}{}
84 Return the full pathname of the file described by the FSSpec object.
87 \begin{funcdesc
}{as_tuple
}{}
88 Return the
\code{(
\var{wdRefNum
},
\var{parID
},
\var{name
})
} tuple of the file described
92 \begin{funcdesc
}{NewAlias
}{\optional{file
}}
93 Create an Alias object pointing to the file described by this
94 FSSpec. If the optional
\var{file
} parameter is present the alias
95 will be relative to that file, otherwise it will be absolute.
98 \begin{funcdesc
}{NewAliasMinimal
}{}
99 Create a minimal alias pointing to this file.
102 \begin{funcdesc
}{GetCreatorType
}{}
103 Return the
4-char creator and type of the file.
106 \begin{funcdesc
}{SetCreatorType
}{creator\, type
}
107 Set the
4-char creator and type of the file.
110 \begin{funcdesc
}{GetFInfo
}{}
111 Return a FInfo object describing the finder info for the file.
114 \begin{funcdesc
}{SetFInfo
}{finfo
}
115 Set the finder info for the file to the values specified in the
119 \subsection{alias objects
}
121 \renewcommand{\indexsubitem}{(alias object attribute)
}
122 \begin{datadesc
}{data
}
123 The raw data for the Alias record, suitable for storing in a resource
124 or transmitting to other programs.
127 \renewcommand{\indexsubitem}{(alias object method)
}
128 \begin{funcdesc
}{Resolve
}{\optional{file
}}
129 Resolve the alias. If the alias was created as a relative alias you
130 should pass the file relative to which it is. Return the FSSpec for
131 the file pointed to and a flag indicating whether the alias object
132 itself was modified during the search process.
135 \begin{funcdesc
}{GetInfo
}{num
}
136 An interface to the C routine
\code{GetAliasInfo()
}.
139 \begin{funcdesc
}{Update
}{file\,
\optional{file2
}}
140 Update the alias to point to the
\var{file
} given. If
\var{file2
} is
141 present a relative alias will be created.
144 Note that it is currently not possible to directly manipulate a resource
145 as an alias object. Hence, after calling
\var{Update
} or after
146 \var{Resolve
} indicates that the alias has changed the Python program
147 is responsible for getting the
\var{data
} from the alias object and
148 modifying the resource.
151 \subsection{FInfo objects
}
153 See Inside Mac for a complete description of what the various fields
156 \renewcommand{\indexsubitem}{(FInfo object attribute)
}
157 \begin{datadesc
}{Creator
}
158 The
4-char creator code of the file.
161 \begin{datadesc
}{Type
}
162 The
4-char type code of the file.
165 \begin{datadesc
}{Flags
}
166 The finder flags for the file as
16-bit integer.
169 \begin{datadesc
}{Location
}
170 A Point giving the position of the file's icon in its folder.
173 \begin{datadesc
}{Fldr
}
174 The folder the file is in (as an integer).