<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>7. macfs --
Various file system services</TITLE>
<META NAME="description" CONTENT="7. macfs --
Various file system services">
<META NAME="keywords" CONTENT="mac">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="mac.css">
<LINK REL="next" HREF="module-ic.html">
<LINK REL="previous" HREF="module-macdnr.html">
<LINK REL="up" HREF="contents.html">
<LINK REL="next" HREF="fsspec-objects.html">
</HEAD>
<BODY bgcolor="#ffffff">
<div class=navigation>
<table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="fsspec-objects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="dnr-result-object.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Macintosh Library Modules</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><a
 href="modindex.html"><img width=32 height=32 align=bottom border=0 alt="modules"
 src="../icons/modules.gif"></a></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="fsspec-objects.html">7.1 FSSpec objects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="contents.html">Contents</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="dnr-result-object.html">6.1 DNR Result Objects</A></span>
<br><hr></div>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION002700000000000000000">
7. <tt class=module>macfs</tt> --
         Various file system services</A>
</H1>

<P>
  
<p class=availability>Availability: <span
 class=platform>Macintosh</span>.</p>

<P>
This module provides access to Macintosh FSSpec handling, the Alias
Manager, <b class=program>finder</b> aliases and the Standard File package.
<a name="l2h-98"></a>
<a name="l2h-99"></a>
<a name="l2h-100"></a>

<P>
Whenever a function or method expects a <var>file</var> argument, this
argument can be one of three things: (1) a full or partial Macintosh
pathname, (2) an FSSpec object or (3) a 3-tuple <tt>(<var>wdRefNum</var>,
<var>parID</var>, <var>name</var>)</tt> as described in <i>Inside
Macintosh: Files</i>. A description of aliases and the Standard File
package can also be found there.

<P>
<dl><dt><b><a name="l2h-85"><tt class=function>FSSpec</tt></a></b> (<var>file</var>)
<dd>
Create an FSSpec object for the specified file.
</dl>

<P>
<dl><dt><b><a name="l2h-86"><tt class=function>RawFSSpec</tt></a></b> (<var>data</var>)
<dd>
Create an FSSpec object given the raw data for the C
structure for the FSSpec as a string.  This is mainly useful
if you have obtained an FSSpec structure over a network.
</dl>

<P>
<dl><dt><b><a name="l2h-87"><tt class=function>RawAlias</tt></a></b> (<var>data</var>)
<dd>
Create an Alias object given the raw data for the C
structure for the alias as a string.  This is mainly useful if you
have obtained an FSSpec structure over a network.
</dl>

<P>
<dl><dt><b><a name="l2h-88"><tt class=function>FInfo</tt></a></b> ()
<dd>
Create a zero-filled FInfo object.
</dl>

<P>
<dl><dt><b><a name="l2h-89"><tt class=function>ResolveAliasFile</tt></a></b> (<var>file</var>)
<dd>
Resolve an alias file. Returns a 3-tuple <tt>(<var>fsspec</var>,
<var>isfolder</var>, <var>aliased</var>)</tt> where <var>fsspec</var> is the resulting
FSSpec object, <var>isfolder</var> is true if <var>fsspec</var> points
to a folder and <var>aliased</var> is true if the file was an alias in the
first place (otherwise the FSSpec object for the file itself
is returned).
</dl>

<P>
<dl><dt><b><a name="l2h-90"><tt class=function>StandardGetFile</tt></a></b> (<big>[</big><var>type, ...</var><big>]</big>)
<dd>
Present the user with a standard ``open input file''
dialog. Optionally, you can pass up to four 4-character file types to limit
the files the user can choose from. The function returns an FSSpec
object and a flag indicating that the user completed the dialog
without cancelling.
</dl>

<P>
<dl><dt><b><a name="l2h-91"><tt class=function>PromptGetFile</tt></a></b> (<var>prompt</var><big>[</big><var>, type, ...</var><big>]</big>)
<dd>
Similar to <tt class=function>StandardGetFile()</tt> but allows you to specify a
prompt.
</dl>

<P>
<dl><dt><b><a name="l2h-92"><tt class=function>StandardPutFile</tt></a></b> (<var>prompt, </var><big>[</big><var>default</var><big>]</big>)
<dd>
Present the user with a standard ``open output file''
dialog. <var>prompt</var> is the prompt string, and the optional
<var>default</var> argument initializes the output file name. The function
returns an FSSpec object and a flag indicating that the user
completed the dialog without cancelling.
</dl>

<P>
<dl><dt><b><a name="l2h-93"><tt class=function>GetDirectory</tt></a></b> (<big>[</big><var>prompt</var><big>]</big>)
<dd>
Present the user with a non-standard ``select a directory''
dialog. <var>prompt</var> is the prompt string, and the optional.
Return an FSSpec object and a success-indicator.
</dl>

<P>
<dl><dt><b><a name="l2h-94"><tt class=function>SetFolder</tt></a></b> (<big>[</big><var>fsspec</var><big>]</big>)
<dd>
Set the folder that is initially presented to the user when one of
the file selection dialogs is presented. <var>fsspec</var> should point to
a file in the folder, not the folder itself (the file need not exist,
though). If no argument is passed the folder will be set to the
current directory, i.e. what <tt class=function>os.getcwd()</tt> returns.

<P>
Note that starting with system 7.5 the user can change Standard File
behaviour with the ``general controls'' controlpanel, thereby making
this call inoperative.
</dl>

<P>
<dl><dt><b><a name="l2h-95"><tt class=function>FindFolder</tt></a></b> (<var>where, which, create</var>)
<dd>
Locates one of the ``special'' folders that MacOS knows about, such as
the trash or the Preferences folder. <var>where</var> is the disk to
search, <var>which</var> is the 4-character string specifying which folder to
locate. Setting <var>create</var> causes the folder to be created if it
does not exist. Returns a <tt>(<var>vrefnum</var>, <var>dirid</var>)</tt> tuple.
</dl>

<P>
<dl><dt><b><a name="l2h-96"><tt class=function>NewAliasMinimalFromFullPath</tt></a></b> (<var>pathname</var>)
<dd>
Return a minimal alias object that points to the given file, which
must be specified as a full pathname. This is the only way to create an
Alias pointing to a non-existing file.

<P>
The constants for <var>where</var> and <var>which</var> can be obtained from the
standard module <var>MACFS</var>.
</dl>

<P>
<dl><dt><b><a name="l2h-97"><tt class=function>FindApplication</tt></a></b> (<var>creator</var>)
<dd>
Locate the application with 4-char creator code <var>creator</var>. The
function returns an FSSpec object pointing to the application.
</dl>

<P>

<p><hr>
<!--Table of Child-Links-->


<UL>
<LI><A NAME="tex2html236"
 HREF="fsspec-objects.html">7.1 FSSpec objects </A>
<LI><A NAME="tex2html237"
 HREF="alias-objects.html">7.2 Alias Objects </A>
<LI><A NAME="tex2html238"
 HREF="finfo-objects.html">7.3 FInfo Objects </A>
</UL>
<!--End of Table of Child-Links-->
<p>
<div class=navigation><hr><table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="fsspec-objects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="dnr-result-object.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Macintosh Library Modules</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><a
 href="modindex.html"><img width=32 height=32 align=bottom border=0 alt="modules"
 src="../icons/modules.gif"></a></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="fsspec-objects.html">7.1 FSSpec objects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="contents.html">Contents</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="dnr-result-object.html">6.1 DNR Result Objects</A></span>
</div>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>Send comments on this document to <a href="mailto:python-docs@python.org">python-docs@python.org</a>.
</ADDRESS>
</BODY>
</HTML>
