| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="mac.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="mac.html" title='Macintosh Library Modules' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-ic.html" /> |
| 13 | <link rel="prev" href="module-macpath.html" /> |
| 14 | <link rel="parent" href="macpython-modules.html" /> |
| 15 | <link rel="next" href="fsspec-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>2.2 macfs -- Various file system services</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="2.1 macpath " |
| 25 | href="module-macpath.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="2. MacPython Modules" |
| 28 | href="macpython-modules.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="2.2.1 FSSpec Objects" |
| 31 | href="fsspec-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Macintosh Library Modules</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-macpath.html">2.1 macpath </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="macpython-modules.html">2. MacPython Modules</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="fsspec-objects.html">2.2.1 FSSpec Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION004200000000000000000"> |
| 56 | 2.2 <tt class="module">macfs</tt> -- |
| 57 | Various file system services</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-macfs"></A> |
| 62 | <p class="availability">Availability: <span |
| 63 | class="platform">Macintosh</span>.</p> |
| 64 | |
| 65 | <P> |
| 66 | <div class="versionnote"><b>Deprecated since release 2.3.</b> |
| 67 | The macfs module should be considered obsolete. For |
| 68 | <tt class="class">FSSpec</tt>, <tt class="class">FSRef</tt> and <tt class="class">Alias</tt> handling use the |
| 69 | <tt class="module">Carbon.File</tt> or <tt class="module"><a href="module-Carbon.Folder.html">Carbon.Folder</a></tt> module. For file |
| 70 | dialogs use the <tt class="module"><a href="module-EasyDialogs.html">EasyDialogs</a></tt> module. Also, this module is |
| 71 | known to not work correctly with UFS partitions.</div><p></p> |
| 72 | |
| 73 | <P> |
| 74 | This module provides access to Macintosh <tt class="class">FSSpec</tt> handling, the |
| 75 | Alias Manager, <b class="program">finder</b> aliases and the Standard File package. |
| 76 | <a id='l2h-17' xml:id='l2h-17'></a> |
| 77 | |
| 78 | <P> |
| 79 | Whenever a function or method expects a <var>file</var> argument, this |
| 80 | argument can be one of three things: (1) a full or partial Macintosh |
| 81 | pathname, (2) an <tt class="class">FSSpec</tt> object or (3) a 3-tuple |
| 82 | <code>(<var>wdRefNum</var>, <var>parID</var>, <var>name</var>)</code> as described in |
| 83 | <em class="citetitle" |
| 84 | >Inside Macintosh: Files</em>. An <tt class="class">FSSpec</tt> can point to |
| 85 | a non-existing file, as long as the folder containing the file exists. |
| 86 | Under MacPython the same is true for a pathname, but not under unix-Pyton |
| 87 | because of the way pathnames and FSRefs works. See Apple's documentation |
| 88 | for details. |
| 89 | |
| 90 | <P> |
| 91 | A description of aliases and the |
| 92 | Standard File package can also be found there. |
| 93 | |
| 94 | <P> |
| 95 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 96 | <td><nobr><b><tt id='l2h-4' xml:id='l2h-4' class="function">FSSpec</tt></b>(</nobr></td> |
| 97 | <td><var>file</var>)</td></tr></table></dt> |
| 98 | <dd> |
| 99 | Create an <tt class="class">FSSpec</tt> object for the specified file. |
| 100 | </dl> |
| 101 | |
| 102 | <P> |
| 103 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 104 | <td><nobr><b><tt id='l2h-5' xml:id='l2h-5' class="function">RawFSSpec</tt></b>(</nobr></td> |
| 105 | <td><var>data</var>)</td></tr></table></dt> |
| 106 | <dd> |
| 107 | Create an <tt class="class">FSSpec</tt> object given the raw data for the C |
| 108 | structure for the <tt class="class">FSSpec</tt> as a string. This is mainly useful |
| 109 | if you have obtained an <tt class="class">FSSpec</tt> structure over a network. |
| 110 | </dl> |
| 111 | |
| 112 | <P> |
| 113 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 114 | <td><nobr><b><tt id='l2h-6' xml:id='l2h-6' class="function">RawAlias</tt></b>(</nobr></td> |
| 115 | <td><var>data</var>)</td></tr></table></dt> |
| 116 | <dd> |
| 117 | Create an <tt class="class">Alias</tt> object given the raw data for the C |
| 118 | structure for the alias as a string. This is mainly useful if you |
| 119 | have obtained an <tt class="class">FSSpec</tt> structure over a network. |
| 120 | </dl> |
| 121 | |
| 122 | <P> |
| 123 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 124 | <td><nobr><b><tt id='l2h-7' xml:id='l2h-7' class="function">FInfo</tt></b>(</nobr></td> |
| 125 | <td><var></var>)</td></tr></table></dt> |
| 126 | <dd> |
| 127 | Create a zero-filled <tt class="class">FInfo</tt> object. |
| 128 | </dl> |
| 129 | |
| 130 | <P> |
| 131 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 132 | <td><nobr><b><tt id='l2h-8' xml:id='l2h-8' class="function">ResolveAliasFile</tt></b>(</nobr></td> |
| 133 | <td><var>file</var>)</td></tr></table></dt> |
| 134 | <dd> |
| 135 | Resolve an alias file. Returns a 3-tuple <code>(<var>fsspec</var>, |
| 136 | <var>isfolder</var>, <var>aliased</var>)</code> where <var>fsspec</var> is the resulting |
| 137 | <tt class="class">FSSpec</tt> object, <var>isfolder</var> is true if <var>fsspec</var> points |
| 138 | to a folder and <var>aliased</var> is true if the file was an alias in the |
| 139 | first place (otherwise the <tt class="class">FSSpec</tt> object for the file itself |
| 140 | is returned). |
| 141 | </dl> |
| 142 | |
| 143 | <P> |
| 144 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 145 | <td><nobr><b><tt id='l2h-9' xml:id='l2h-9' class="function">StandardGetFile</tt></b>(</nobr></td> |
| 146 | <td><var></var><big>[</big><var>type, ...</var><big>]</big><var></var>)</td></tr></table></dt> |
| 147 | <dd> |
| 148 | Present the user with a standard ``open input file'' |
| 149 | dialog. Optionally, you can pass up to four 4-character file types to limit |
| 150 | the files the user can choose from. The function returns an <tt class="class">FSSpec</tt> |
| 151 | object and a flag indicating that the user completed the dialog |
| 152 | without cancelling. |
| 153 | </dl> |
| 154 | |
| 155 | <P> |
| 156 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 157 | <td><nobr><b><tt id='l2h-10' xml:id='l2h-10' class="function">PromptGetFile</tt></b>(</nobr></td> |
| 158 | <td><var>prompt</var><big>[</big><var>, type, ...</var><big>]</big><var></var>)</td></tr></table></dt> |
| 159 | <dd> |
| 160 | Similar to <tt class="function">StandardGetFile()</tt> but allows you to specify a |
| 161 | prompt which will be displayed at the top of the dialog. |
| 162 | </dl> |
| 163 | |
| 164 | <P> |
| 165 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 166 | <td><nobr><b><tt id='l2h-11' xml:id='l2h-11' class="function">StandardPutFile</tt></b>(</nobr></td> |
| 167 | <td><var>prompt</var><big>[</big><var>, default</var><big>]</big><var></var>)</td></tr></table></dt> |
| 168 | <dd> |
| 169 | Present the user with a standard ``open output file'' |
| 170 | dialog. <var>prompt</var> is the prompt string, and the optional |
| 171 | <var>default</var> argument initializes the output file name. The function |
| 172 | returns an <tt class="class">FSSpec</tt> object and a flag indicating that the user |
| 173 | completed the dialog without cancelling. |
| 174 | </dl> |
| 175 | |
| 176 | <P> |
| 177 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 178 | <td><nobr><b><tt id='l2h-12' xml:id='l2h-12' class="function">GetDirectory</tt></b>(</nobr></td> |
| 179 | <td><var></var><big>[</big><var>prompt</var><big>]</big><var></var>)</td></tr></table></dt> |
| 180 | <dd> |
| 181 | Present the user with a non-standard ``select a directory'' dialog. You |
| 182 | have to first open the directory before clicking on the ``select current |
| 183 | directory'' button. <var>prompt</var> is the prompt string which will be |
| 184 | displayed at the top of the dialog. Return an <tt class="class">FSSpec</tt> object and |
| 185 | a success-indicator. |
| 186 | </dl> |
| 187 | |
| 188 | <P> |
| 189 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 190 | <td><nobr><b><tt id='l2h-13' xml:id='l2h-13' class="function">SetFolder</tt></b>(</nobr></td> |
| 191 | <td><var></var><big>[</big><var>fsspec</var><big>]</big><var></var>)</td></tr></table></dt> |
| 192 | <dd> |
| 193 | Set the folder that is initially presented to the user when one of |
| 194 | the file selection dialogs is presented. <var>fsspec</var> should point to |
| 195 | a file in the folder, not the folder itself (the file need not exist, |
| 196 | though). If no argument is passed the folder will be set to the |
| 197 | current directory, i.e. what <tt class="function">os.getcwd()</tt> returns. |
| 198 | |
| 199 | <P> |
| 200 | Note that starting with System 7.5 the user can change Standard File |
| 201 | behaviour with the ``general controls'' control panel, thereby making |
| 202 | this call inoperative. |
| 203 | </dl> |
| 204 | |
| 205 | <P> |
| 206 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 207 | <td><nobr><b><tt id='l2h-14' xml:id='l2h-14' class="function">FindFolder</tt></b>(</nobr></td> |
| 208 | <td><var>where, which, create</var>)</td></tr></table></dt> |
| 209 | <dd> |
| 210 | Locates one of the ``special'' folders that Mac OS knows about, such as |
| 211 | the trash or the Preferences folder. <var>where</var> is the disk to |
| 212 | search, <var>which</var> is the 4-character string specifying which folder to |
| 213 | locate. Setting <var>create</var> causes the folder to be created if it |
| 214 | does not exist. Returns a <code>(<var>vrefnum</var>, <var>dirid</var>)</code> tuple. |
| 215 | |
| 216 | <P> |
| 217 | The constants for <var>where</var> and <var>which</var> can be obtained from the |
| 218 | standard module <var>Carbon.Folders</var>. |
| 219 | </dl> |
| 220 | |
| 221 | <P> |
| 222 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 223 | <td><nobr><b><tt id='l2h-15' xml:id='l2h-15' class="function">NewAliasMinimalFromFullPath</tt></b>(</nobr></td> |
| 224 | <td><var>pathname</var>)</td></tr></table></dt> |
| 225 | <dd> |
| 226 | Return a minimal <tt class="class">alias</tt> object that points to the given file, which |
| 227 | must be specified as a full pathname. This is the only way to create an |
| 228 | <tt class="class">Alias</tt> pointing to a non-existing file. |
| 229 | |
| 230 | <P> |
| 231 | </dl> |
| 232 | |
| 233 | <P> |
| 234 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 235 | <td><nobr><b><tt id='l2h-16' xml:id='l2h-16' class="function">FindApplication</tt></b>(</nobr></td> |
| 236 | <td><var>creator</var>)</td></tr></table></dt> |
| 237 | <dd> |
| 238 | Locate the application with 4-character creator code <var>creator</var>. The |
| 239 | function returns an <tt class="class">FSSpec</tt> object pointing to the application. |
| 240 | </dl> |
| 241 | |
| 242 | <P> |
| 243 | |
| 244 | <p><br /></p><hr class='online-navigation' /> |
| 245 | <div class='online-navigation'> |
| 246 | <!--Table of Child-Links--> |
| 247 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 248 | |
| 249 | <UL CLASS="ChildLinks"> |
| 250 | <LI><A href="fsspec-objects.html">2.2.1 FSSpec Objects</a> |
| 251 | <LI><A href="alias-objects.html">2.2.2 Alias Objects</a> |
| 252 | <LI><A href="finfo-objects.html">2.2.3 FInfo Objects</a> |
| 253 | </ul> |
| 254 | <!--End of Table of Child-Links--> |
| 255 | </div> |
| 256 | |
| 257 | <DIV CLASS="navigation"> |
| 258 | <div class='online-navigation'> |
| 259 | <p></p><hr /> |
| 260 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 261 | <tr> |
| 262 | <td class='online-navigation'><a rel="prev" title="2.1 macpath " |
| 263 | href="module-macpath.html"><img src='../icons/previous.png' |
| 264 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 265 | <td class='online-navigation'><a rel="parent" title="2. MacPython Modules" |
| 266 | href="macpython-modules.html"><img src='../icons/up.png' |
| 267 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 268 | <td class='online-navigation'><a rel="next" title="2.2.1 FSSpec Objects" |
| 269 | href="fsspec-objects.html"><img src='../icons/next.png' |
| 270 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 271 | <td align="center" width="100%">Macintosh Library Modules</td> |
| 272 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 273 | href="contents.html"><img src='../icons/contents.png' |
| 274 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 275 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 276 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 277 | <td class='online-navigation'><a rel="index" title="Index" |
| 278 | href="genindex.html"><img src='../icons/index.png' |
| 279 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 280 | </tr></table> |
| 281 | <div class='online-navigation'> |
| 282 | <b class="navlabel">Previous:</b> |
| 283 | <a class="sectref" rel="prev" href="module-macpath.html">2.1 macpath </A> |
| 284 | <b class="navlabel">Up:</b> |
| 285 | <a class="sectref" rel="parent" href="macpython-modules.html">2. MacPython Modules</A> |
| 286 | <b class="navlabel">Next:</b> |
| 287 | <a class="sectref" rel="next" href="fsspec-objects.html">2.2.1 FSSpec Objects</A> |
| 288 | </div> |
| 289 | </div> |
| 290 | <hr /> |
| 291 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 292 | </DIV> |
| 293 | <!--End of Navigation Panel--> |
| 294 | <ADDRESS> |
| 295 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 296 | </ADDRESS> |
| 297 | </BODY> |
| 298 | </HTML> |