blob: eae867db1f34142c3c11a3464a9020f9e09b47dc [file] [log] [blame]
Georg Brandl8ec7f652007-08-15 14:28:01 +00001
2:mod:`macostools` --- Convenience routines for file manipulation
3================================================================
4
5.. module:: macostools
6 :platform: Mac
7 :synopsis: Convenience routines for file manipulation.
Benjamin Peterson23681932008-05-12 21:42:13 +00008 :deprecated:
Georg Brandl8ec7f652007-08-15 14:28:01 +00009
10
11This module contains some convenience routines for file-manipulation on the
12Macintosh. All file parameters can be specified as pathnames, :class:`FSRef` or
13:class:`FSSpec` objects. This module expects a filesystem which supports forked
14files, so it should not be used on UFS partitions.
15
Benjamin Peterson23681932008-05-12 21:42:13 +000016.. warning::
17
18 This module is removed in 3.0.
19
Georg Brandl8ec7f652007-08-15 14:28:01 +000020The :mod:`macostools` module defines the following functions:
21
22
23.. function:: copy(src, dst[, createpath[, copytimes]])
24
25 Copy file *src* to *dst*. If *createpath* is non-zero the folders leading to
26 *dst* are created if necessary. The method copies data and resource fork and
27 some finder information (creator, type, flags) and optionally the creation,
28 modification and backup times (default is to copy them). Custom icons, comments
29 and icon position are not copied.
30
31
32.. function:: copytree(src, dst)
33
34 Recursively copy a file tree from *src* to *dst*, creating folders as needed.
35 *src* and *dst* should be specified as pathnames.
36
37
38.. function:: mkalias(src, dst)
39
40 Create a finder alias *dst* pointing to *src*.
41
42
43.. function:: touched(dst)
44
45 Tell the finder that some bits of finder-information such as creator or type for
46 file *dst* has changed. The file can be specified by pathname or fsspec. This
47 call should tell the finder to redraw the files icon.
48
49 .. deprecated:: 2.6
50 The function is a no-op on OS X.
51
52
53.. data:: BUFSIZ
54
55 The buffer size for ``copy``, default 1 megabyte.
56
57Note that the process of creating finder aliases is not specified in the Apple
58documentation. Hence, aliases created with :func:`mkalias` could conceivably
59have incompatible behaviour in some cases.
60
61
62:mod:`findertools` --- The :program:`finder`'s Apple Events interface
63=====================================================================
64
65.. module:: findertools
66 :platform: Mac
67 :synopsis: Wrappers around the finder's Apple Events interface.
68
69
70.. index:: single: AppleEvents
71
72This module contains routines that give Python programs access to some
73functionality provided by the finder. They are implemented as wrappers around
74the AppleEvent interface to the finder.
75
76All file and folder parameters can be specified either as full pathnames, or as
77:class:`FSRef` or :class:`FSSpec` objects.
78
79The :mod:`findertools` module defines the following functions:
80
81
82.. function:: launch(file)
83
84 Tell the finder to launch *file*. What launching means depends on the file:
85 applications are started, folders are opened and documents are opened in the
86 correct application.
87
88
89.. function:: Print(file)
90
91 Tell the finder to print a file. The behaviour is identical to selecting the
92 file and using the print command in the finder's file menu.
93
94
95.. function:: copy(file, destdir)
96
97 Tell the finder to copy a file or folder *file* to folder *destdir*. The
98 function returns an :class:`Alias` object pointing to the new file.
99
100
101.. function:: move(file, destdir)
102
103 Tell the finder to move a file or folder *file* to folder *destdir*. The
104 function returns an :class:`Alias` object pointing to the new file.
105
106
107.. function:: sleep()
108
109 Tell the finder to put the Macintosh to sleep, if your machine supports it.
110
111
112.. function:: restart()
113
114 Tell the finder to perform an orderly restart of the machine.
115
116
117.. function:: shutdown()
118
119 Tell the finder to perform an orderly shutdown of the machine.
120