blob: 74d19709b064f3181523084b4d0ca209149f7aaf [file] [log] [blame]
Guido van Rossum470be141995-03-17 16:07:09 +00001\section{Built-in Module \sectcode{macfs}}
Jack Jansene4be9be1995-02-28 15:46:09 +00002\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
Guido van Rossum470be141995-03-17 16:07:09 +000021FSSpec as a string. This is mainly useful if you have obtained an
22FSSpec structure over a network.
Jack Jansene4be9be1995-02-28 15:46:09 +000023\end{funcdesc}
24
25\begin{funcdesc}{RawAlias}{data}
Guido van Rossum470be141995-03-17 16:07:09 +000026Create an Alias object given the raw data for the C structure for the
27alias as a string. This is mainly useful if you have obtained an
28FSSpec structure over a network.
Jack Jansene4be9be1995-02-28 15:46:09 +000029\end{funcdesc}
30
31\begin{funcdesc}{ResolveAliasFile}{file}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000032Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, \var{isfolder},
33\var{aliased})} where \var{fsspec} is the resulting FSSpec object,
Jack Jansene4be9be1995-02-28 15:46:09 +000034\var{isfolder} is true if \var{fsspec} points to a folder and
35\var{aliased} is true if the file was an alias in the first place
36(otherwise the FSSpec object for the file itself is returned).
37\end{funcdesc}
38
39\begin{funcdesc}{StandardGetFile}{\optional{type\, ...}}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000040Present the user with a standard ``open input file''
Jack Jansene4be9be1995-02-28 15:46:09 +000041dialog. Optionally, you can pass up to four 4-char file types to limit
42the files the user can choose from. The function returns an FSSpec
43object and a flag indicating that the user completed the dialog
44without cancelling.
45\end{funcdesc}
46
47\begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}}
48Present the user with a standard ``open output file''
49dialog. \var{prompt} is the prompt string, and the optional
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000050\var{default} argument initializes the output file name. The function
Jack Jansene4be9be1995-02-28 15:46:09 +000051returns an FSSpec object and a flag indicating that the user completed
52the dialog without cancelling.
53\end{funcdesc}
54
55\begin{funcdesc}{GetDirectory}{}
56Present the user with a non-standard ``select a directory''
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000057dialog. Return an FSSpec object and a success-indicator.
Jack Jansene4be9be1995-02-28 15:46:09 +000058\end{funcdesc}
59
60\subsection{FSSpec objects}
61
Guido van Rossum470be141995-03-17 16:07:09 +000062\renewcommand{\indexsubitem}{(FSSpec object attribute)}
Jack Jansene4be9be1995-02-28 15:46:09 +000063\begin{datadesc}{data}
64The raw data from the FSSpec object, suitable for passing
65to other applications, for instance.
66\end{datadesc}
67
Guido van Rossum470be141995-03-17 16:07:09 +000068\renewcommand{\indexsubitem}{(FSSpec object method)}
Jack Jansene4be9be1995-02-28 15:46:09 +000069\begin{funcdesc}{as_pathname}{}
70Return the full pathname of the file described by the FSSpec object.
71\end{funcdesc}
72
73\begin{funcdesc}{as_tuple}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000074Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of the file described
Jack Jansene4be9be1995-02-28 15:46:09 +000075by the FSSpec object.
76\end{funcdesc}
77
78\begin{funcdesc}{NewAlias}{\optional{file}}
79Create an Alias object pointing to the file described by this
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000080FSSpec. If the optional \var{file} parameter is present the alias
Jack Jansene4be9be1995-02-28 15:46:09 +000081will be relative to that file, otherwise it will be absolute.
82\end{funcdesc}
83
84\begin{funcdesc}{NewAliasMinimal}{}
85Create a minimal alias pointing to this file.
86\end{funcdesc}
87
88\begin{funcdesc}{GetCreatorType}{}
89Return the 4-char creator and type of the file.
90\end{funcdesc}
91
92\begin{funcdesc}{SetCreatorType}{creator\, type}
93Set the 4-char creator and type of the file.
94\end{funcdesc}
95
96\subsection{alias objects}
97
Guido van Rossum470be141995-03-17 16:07:09 +000098\renewcommand{\indexsubitem}{(alias object attribute)}
Jack Jansene4be9be1995-02-28 15:46:09 +000099\begin{datadesc}{data}
100The raw data for the Alias record, suitable for storing in a resource
101or transmitting to other programs.
102\end{datadesc}
103
Guido van Rossum470be141995-03-17 16:07:09 +0000104\renewcommand{\indexsubitem}{(alias object method)}
Jack Jansene4be9be1995-02-28 15:46:09 +0000105\begin{funcdesc}{Resolve}{\optional{file}}
106Resolve the alias. If the alias was created as a relative alias you
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000107should pass the file relative to which it is. Return the FSSpec for
Jack Jansene4be9be1995-02-28 15:46:09 +0000108the file pointed to and a flag indicating whether the alias object
109itself was modified during the search process.
110\end{funcdesc}
111
112\begin{funcdesc}{GetInfo}{num}
113An interface to the C routine \code{GetAliasInfo()}.
114\end{funcdesc}
115
116\begin{funcdesc}{Update}{file\, \optional{file2}}
117Update the alias to point to the \var{file} given. If \var{file2} is
118present a relative alias will be created.
119\end{funcdesc}
120
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000121Note that it is currently not possible to directly manipulate a resource
Jack Jansene4be9be1995-02-28 15:46:09 +0000122as an alias object. Hence, after calling \var{Update} or after
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000123\var{Resolve} indicates that the alias has changed the Python program
Jack Jansene4be9be1995-02-28 15:46:09 +0000124is responsible for getting the \var{data} from the alias object and
125modifying the resource.
126
127