blob: 80ec76d2a4a05fc00b67e96432c13c8d259fdc60 [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
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000010argument can be one of three things:\ (1) a full or partial Macintosh
Jack Jansene4be9be1995-02-28 15:46:09 +000011pathname, (2) an FSSpec object or (3) a 3-tuple \code{(wdRefNum,
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000012parID, name)} as described in Inside Mac VI\@. A description of aliases
Jack Jansene4be9be1995-02-28 15:46:09 +000013and 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}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000029Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, \var{isfolder},
30\var{aliased})} where \var{fsspec} is the resulting FSSpec object,
Jack Jansene4be9be1995-02-28 15:46:09 +000031\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\, ...}}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000037Present the user with a standard ``open input file''
Jack Jansene4be9be1995-02-28 15:46:09 +000038dialog. 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
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000047\var{default} argument initializes the output file name. The function
Jack Jansene4be9be1995-02-28 15:46:09 +000048returns 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''
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000054dialog. Return an FSSpec object and a success-indicator.
Jack Jansene4be9be1995-02-28 15:46:09 +000055\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}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000070Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of the file described
Jack Jansene4be9be1995-02-28 15:46:09 +000071by the FSSpec object.
72\end{funcdesc}
73
74\begin{funcdesc}{NewAlias}{\optional{file}}
75Create an Alias object pointing to the file described by this
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000076FSSpec. If the optional \var{file} parameter is present the alias
Jack Jansene4be9be1995-02-28 15:46:09 +000077will 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
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000102should pass the file relative to which it is. Return the FSSpec for
Jack Jansene4be9be1995-02-28 15:46:09 +0000103the 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
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000116Note that it is currently not possible to directly manipulate a resource
Jack Jansene4be9be1995-02-28 15:46:09 +0000117as an alias object. Hence, after calling \var{Update} or after
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000118\var{Resolve} indicates that the alias has changed the Python program
Jack Jansene4be9be1995-02-28 15:46:09 +0000119is responsible for getting the \var{data} from the alias object and
120modifying the resource.
121
122