<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"mac.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"mac.html" title='Macintosh Library Modules'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"module-ic.html" />
<link rel=
"prev" href=
"module-macpath.html" />
<link rel=
"parent" href=
"macpython-modules.html" />
<link rel=
"next" href=
"fsspec-objects.html" />
<meta name='aesop' content='information'
/>
<title>2.2 macfs -- Various file system services
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"2.1 macpath "
href=
"module-macpath.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"2. MacPython Modules"
href=
"macpython-modules.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"2.2.1 FSSpec Objects"
href=
"fsspec-objects.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Macintosh Library Modules
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-macpath.html">2.1 macpath
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"macpython-modules.html">2. MacPython Modules
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"fsspec-objects.html">2.2.1 FSSpec Objects
</A>
<!--End of Navigation Panel-->
<H1><A NAME=
"SECTION004200000000000000000">
2.2 <tt class=
"module">macfs
</tt> --
Various file system services
</A>
<A NAME=
"module-macfs"></A>
<p class=
"availability">Availability:
<span
class=
"platform">Macintosh
</span>.
</p>
<div class=
"versionnote"><b>Deprecated since release
2.3.
</b>
The macfs module should be considered obsolete. For
<tt class=
"class">FSSpec
</tt>,
<tt class=
"class">FSRef
</tt> and
<tt class=
"class">Alias
</tt> handling use the
<tt class=
"module">Carbon.File
</tt> or
<tt class=
"module"><a href=
"module-Carbon.Folder.html">Carbon.Folder
</a></tt> module. For file
dialogs use the
<tt class=
"module"><a href=
"module-EasyDialogs.html">EasyDialogs
</a></tt> module. Also, this module is
known to not work correctly with UFS partitions.
</div><p></p>
This module provides access to Macintosh
<tt class=
"class">FSSpec
</tt> handling, the
Alias Manager,
<b class=
"program">finder
</b> aliases and the Standard File package.
<a id='l2h-
17' xml:id='l2h-
17'
></a>
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
<tt class=
"class">FSSpec
</tt> object or (
3) a
3-tuple
<code>(
<var>wdRefNum
</var>,
<var>parID
</var>,
<var>name
</var>)
</code> as described in
>Inside Macintosh: Files
</em>. An
<tt class=
"class">FSSpec
</tt> can point to
a non-existing file, as long as the folder containing the file exists.
Under MacPython the same is true for a pathname, but not under unix-Pyton
because of the way pathnames and FSRefs works. See Apple's documentation
A description of aliases and the
Standard File package can also be found there.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4' xml:id='l2h-
4'
class=
"function">FSSpec
</tt></b>(
</nobr></td>
<td><var>file
</var>)
</td></tr></table></dt>
Create an
<tt class=
"class">FSSpec
</tt> object for the specified file.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5' xml:id='l2h-
5'
class=
"function">RawFSSpec
</tt></b>(
</nobr></td>
<td><var>data
</var>)
</td></tr></table></dt>
Create an
<tt class=
"class">FSSpec
</tt> object given the raw data for the C
structure for the
<tt class=
"class">FSSpec
</tt> as a string. This is mainly useful
if you have obtained an
<tt class=
"class">FSSpec
</tt> structure over a network.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
6' xml:id='l2h-
6'
class=
"function">RawAlias
</tt></b>(
</nobr></td>
<td><var>data
</var>)
</td></tr></table></dt>
Create an
<tt class=
"class">Alias
</tt> object given the raw data for the C
structure for the alias as a string. This is mainly useful if you
have obtained an
<tt class=
"class">FSSpec
</tt> structure over a network.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
7' xml:id='l2h-
7'
class=
"function">FInfo
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Create a zero-filled
<tt class=
"class">FInfo
</tt> object.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
8' xml:id='l2h-
8'
class=
"function">ResolveAliasFile
</tt></b>(
</nobr></td>
<td><var>file
</var>)
</td></tr></table></dt>
Resolve an alias file. Returns a
3-tuple
<code>(
<var>fsspec
</var>,
<var>isfolder
</var>,
<var>aliased
</var>)
</code> where
<var>fsspec
</var> is the resulting
<tt class=
"class">FSSpec
</tt> 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
<tt class=
"class">FSSpec
</tt> object for the file itself
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
9' xml:id='l2h-
9'
class=
"function">StandardGetFile
</tt></b>(
</nobr></td>
<td><var></var><big>[
</big><var>type, ...
</var><big>]
</big><var></var>)
</td></tr></table></dt>
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
<tt class=
"class">FSSpec
</tt>
object and a flag indicating that the user completed the dialog
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
10' xml:id='l2h-
10'
class=
"function">PromptGetFile
</tt></b>(
</nobr></td>
<td><var>prompt
</var><big>[
</big><var>, type, ...
</var><big>]
</big><var></var>)
</td></tr></table></dt>
Similar to
<tt class=
"function">StandardGetFile()
</tt> but allows you to specify a
prompt which will be displayed at the top of the dialog.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
11' xml:id='l2h-
11'
class=
"function">StandardPutFile
</tt></b>(
</nobr></td>
<td><var>prompt
</var><big>[
</big><var>, default
</var><big>]
</big><var></var>)
</td></tr></table></dt>
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
<tt class=
"class">FSSpec
</tt> object and a flag indicating that the user
completed the dialog without cancelling.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
12' xml:id='l2h-
12'
class=
"function">GetDirectory
</tt></b>(
</nobr></td>
<td><var></var><big>[
</big><var>prompt
</var><big>]
</big><var></var>)
</td></tr></table></dt>
Present the user with a non-standard ``select a directory'' dialog. You
have to first open the directory before clicking on the ``select current
directory'' button.
<var>prompt
</var> is the prompt string which will be
displayed at the top of the dialog. Return an
<tt class=
"class">FSSpec
</tt> object and
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
13' xml:id='l2h-
13'
class=
"function">SetFolder
</tt></b>(
</nobr></td>
<td><var></var><big>[
</big><var>fsspec
</var><big>]
</big><var></var>)
</td></tr></table></dt>
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.
Note that starting with System
7.5 the user can change Standard File
behaviour with the ``general controls'' control panel, thereby making
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
14' xml:id='l2h-
14'
class=
"function">FindFolder
</tt></b>(
</nobr></td>
<td><var>where, which, create
</var>)
</td></tr></table></dt>
Locates one of the ``special'' folders that Mac OS 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
<code>(
<var>vrefnum
</var>,
<var>dirid
</var>)
</code> tuple.
The constants for
<var>where
</var> and
<var>which
</var> can be obtained from the
standard module
<var>Carbon.Folders
</var>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
15' xml:id='l2h-
15'
class=
"function">NewAliasMinimalFromFullPath
</tt></b>(
</nobr></td>
<td><var>pathname
</var>)
</td></tr></table></dt>
Return a minimal
<tt class=
"class">alias
</tt> object that points to the given file, which
must be specified as a full pathname. This is the only way to create an
<tt class=
"class">Alias
</tt> pointing to a non-existing file.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
16' xml:id='l2h-
16'
class=
"function">FindApplication
</tt></b>(
</nobr></td>
<td><var>creator
</var>)
</td></tr></table></dt>
Locate the application with
4-character creator code
<var>creator
</var>. The
function returns an
<tt class=
"class">FSSpec
</tt> object pointing to the application.
<p><br /></p><hr class='online-navigation'
/>
<div class='online-navigation'
>
<!--Table of Child-Links-->
<A NAME=
"CHILD_LINKS"><STRONG>Subsections
</STRONG></a>
<LI><A href=
"fsspec-objects.html">2.2.1 FSSpec Objects
</a>
<LI><A href=
"alias-objects.html">2.2.2 Alias Objects
</a>
<LI><A href=
"finfo-objects.html">2.2.3 FInfo Objects
</a>
<!--End of Table of Child-Links-->
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"2.1 macpath "
href=
"module-macpath.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"2. MacPython Modules"
href=
"macpython-modules.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"2.2.1 FSSpec Objects"
href=
"fsspec-objects.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Macintosh Library Modules
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-macpath.html">2.1 macpath
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"macpython-modules.html">2. MacPython Modules
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"fsspec-objects.html">2.2.1 FSSpec Objects
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.