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