blob: bd22498cab7633744dc467ed375747d8bf5af248 [file] [log] [blame]
Jack Jansene4be9be1995-02-28 15:46:09 +00001\section{Built-in module \sectcode{macfs}}
2\bimodindex{macfs}
3
Guido van Rossum86751151995-02-28 17:14:32 +00004\renewcommand{\indexsubitem}{(in module macfs)}
5
Jack Jansene4be9be1995-02-28 15:46:09 +00006This module provides access to macintosh FSSpec handling, the Alias
7Manager, finder aliases and the Standard File package.
8
9Whenever a function or method expects a \var{file} argument, this
10argument can be one of three things: (1) a full or partial macintosh
11pathname, (2) an FSSpec object or (3) a 3-tuple \code{(wdRefNum,
12parID, name)} as described in Inside Mac VI. A description of aliases
13and the standard file package can also be found there.
14
15\begin{funcdesc}{FSSpec}{file}
16Create an FSSpec object for the specified file.
17\end{funcdesc}
18
19\begin{funcdesc}{RawFSSpec}{data}
20Create an FSSpec object given the raw data for the C structure for the
21FSSpec.
22\end{funcdesc}
23
24\begin{funcdesc}{RawAlias}{data}
25Create an Alias object given the raw data for the alias.
26\end{funcdesc}
27
28\begin{funcdesc}{ResolveAliasFile}{file}
29Resolve an alias file. Returns a 3-tuple \code{(fsspec, isfolder,
30aliased)} where \var{fsspec} is the resulting FSSpec object,
31\var{isfolder} is true if \var{fsspec} points to a folder and
32\var{aliased} is true if the file was an alias in the first place
33(otherwise the FSSpec object for the file itself is returned).
34\end{funcdesc}
35
36\begin{funcdesc}{StandardGetFile}{\optional{type\, ...}}
37Present the user with a standard ``open onput file''
38dialog. Optionally, you can pass up to four 4-char file types to limit
39the files the user can choose from. The function returns an FSSpec
40object and a flag indicating that the user completed the dialog
41without cancelling.
42\end{funcdesc}
43
44\begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}}
45Present the user with a standard ``open output file''
46dialog. \var{prompt} is the prompt string, and the optional
47\var{default} argument initialized the output file name. The function
48returns an FSSpec object and a flag indicating that the user completed
49the dialog without cancelling.
50\end{funcdesc}
51
52\begin{funcdesc}{GetDirectory}{}
53Present the user with a non-standard ``select a directory''
54dialog. Returns an FSSpec object and a success-indicator.
55\end{funcdesc}
56
57\subsection{FSSpec objects}
58
59\renewcommand{\indexsubitem}{(FSSpec object method)}
60\begin{datadesc}{data}
61The raw data from the FSSpec object, suitable for passing
62to other applications, for instance.
63\end{datadesc}
64
65\begin{funcdesc}{as_pathname}{}
66Return the full pathname of the file described by the FSSpec object.
67\end{funcdesc}
68
69\begin{funcdesc}{as_tuple}{}
70Return the \code{(wdRefNum, parID, name)} tuple of the file described
71by the FSSpec object.
72\end{funcdesc}
73
74\begin{funcdesc}{NewAlias}{\optional{file}}
75Create an Alias object pointing to the file described by this
76FSSpec. If the optional \code{file} parameter is present the alias
77will be relative to that file, otherwise it will be absolute.
78\end{funcdesc}
79
80\begin{funcdesc}{NewAliasMinimal}{}
81Create a minimal alias pointing to this file.
82\end{funcdesc}
83
84\begin{funcdesc}{GetCreatorType}{}
85Return the 4-char creator and type of the file.
86\end{funcdesc}
87
88\begin{funcdesc}{SetCreatorType}{creator\, type}
89Set the 4-char creator and type of the file.
90\end{funcdesc}
91
92\subsection{alias objects}
93
94\renewcommand{\indexsubitem}{(alias object method)}
95\begin{datadesc}{data}
96The raw data for the Alias record, suitable for storing in a resource
97or transmitting to other programs.
98\end{datadesc}
99
100\begin{funcdesc}{Resolve}{\optional{file}}
101Resolve the alias. If the alias was created as a relative alias you
102should pass the file relative to which it is. Returns the FSSpec for
103the file pointed to and a flag indicating whether the alias object
104itself was modified during the search process.
105\end{funcdesc}
106
107\begin{funcdesc}{GetInfo}{num}
108An interface to the C routine \code{GetAliasInfo()}.
109\end{funcdesc}
110
111\begin{funcdesc}{Update}{file\, \optional{file2}}
112Update the alias to point to the \var{file} given. If \var{file2} is
113present a relative alias will be created.
114\end{funcdesc}
115
116Note that is currently not possible to directly manipulate a resource
117as an alias object. Hence, after calling \var{Update} or after
118\var{Resolve} indicates that the alias has changed the python program
119is responsible for getting the \var{data} from the alias object and
120modifying the resource.
121
122