]> git.saurik.com Git - wxWidgets.git/blob - src/mac/morefile/FileCopy.h
set more event object fields for lbox dbl click events
[wxWidgets.git] / src / mac / morefile / FileCopy.h
1 /*
2 ** Apple Macintosh Developer Technical Support
3 **
4 ** FileCopy: A robust, general purpose file copy routine.
5 **
6 ** by Jim Luther, Apple Developer Technical Support Emeritus
7 **
8 ** File: FileCopy.h
9 **
10 ** Copyright © 1992-1998 Apple Computer, Inc.
11 ** All rights reserved.
12 **
13 ** You may incorporate this sample code into your applications without
14 ** restriction, though the sample code has been provided "AS IS" and the
15 ** responsibility for its operation is 100% yours. However, what you are
16 ** not permitted to do is to redistribute the source as "DSC Sample Code"
17 ** after having made changes. If you're going to re-distribute the source,
18 ** we require that you make it clear in the source that the code was
19 ** descended from Apple Sample Code, but that you've made changes.
20 */
21
22 #ifndef __FILECOPY__
23 #define __FILECOPY__
24
25 #include <Types.h>
26 #include <Files.h>
27
28 #include "optim.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /*****************************************************************************/
35
36 pascal OSErr FileCopy(short srcVRefNum,
37 long srcDirID,
38 ConstStr255Param srcName,
39 short dstVRefNum,
40 long dstDirID,
41 ConstStr255Param dstPathname,
42 ConstStr255Param copyName,
43 void *copyBufferPtr,
44 long copyBufferSize,
45 Boolean preflight);
46 /* ¦ Duplicate a file and optionally rename it.
47 The FileCopy function duplicates a file and optionally renames it.
48 Since the PBHCopyFile routine is only available on some
49 AFP server volumes under specific conditions, this routine
50 either uses PBHCopyFile, or does all of the work PBHCopyFile
51 does. The srcVRefNum, srcDirID and srcName are used to
52 determine the location of the file to copy. The dstVRefNum
53 dstDirID and dstPathname are used to determine the location of
54 the destination directory. If copyName <> NIL, then it points
55 to the name of the new file. If copyBufferPtr <> NIL, it
56 points to a buffer of copyBufferSize that is used to copy
57 the file's data. The larger the supplied buffer, the
58 faster the copy. If copyBufferPtr = NIL, then this routine
59 allocates a buffer in the application heap. If you pass a
60 copy buffer to this routine, make its size a multiple of 512
61 ($200) bytes for optimum performance.
62
63 srcVRefNum input: Source volume specification.
64 srcDirID input: Source directory ID.
65 srcName input: Source file name.
66 dstVRefNum input: Destination volume specification.
67 dstDirID input: Destination directory ID.
68 dstPathname input: Pointer to destination directory name, or
69 nil when dstDirID specifies a directory.
70 copyName input: Points to the new file name if the file is
71 to be renamed or nil if the file isn't to
72 be renamed.
73 copyBufferPtr input: Points to a buffer of copyBufferSize that
74 is used the i/o buffer for the copy or
75 nil if you want FileCopy to allocate its
76 own buffer in the application heap.
77 copyBufferSize input: The size of the buffer pointed to
78 by copyBufferPtr.
79 preflight input: If true, FileCopy makes sure there are enough
80 allocation blocks on the destination volume to
81 hold both the data and resource forks before
82 starting the copy.
83
84 Result Codes
85 noErr 0 No error
86 readErr Ð19 Driver does not respond to read requests
87 writErr Ð20 Driver does not respond to write requests
88 badUnitErr Ð21 Driver reference number does not
89 match unit table
90 unitEmptyErr Ð22 Driver reference number specifies a
91 nil handle in unit table
92 abortErr Ð27 Request aborted by KillIO
93 notOpenErr Ð28 Driver not open
94 dskFulErr -34 Destination volume is full
95 nsvErr -35 No such volume
96 ioErr -36 I/O error
97 bdNamErr -37 Bad filename
98 tmfoErr -42 Too many files open
99 fnfErr -43 Source file not found, or destination
100 directory does not exist
101 wPrErr -44 Volume locked by hardware
102 fLckdErr -45 File is locked
103 vLckdErr -46 Destination volume is read-only
104 fBsyErr -47 The source or destination file could
105 not be opened with the correct access
106 modes
107 dupFNErr -48 Destination file already exists
108 opWrErr -49 File already open for writing
109 paramErr -50 No default volume or function not
110 supported by volume
111 permErr -54 File is already open and cannot be opened using specified deny modes
112 memFullErr -108 Copy buffer could not be allocated
113 dirNFErr -120 Directory not found or incomplete pathname
114 wrgVolTypErr -123 Function not supported by volume
115 afpAccessDenied -5000 User does not have the correct access
116 afpDenyConflict -5006 The source or destination file could
117 not be opened with the correct access
118 modes
119 afpObjectTypeErr -5025 Source is a directory, directory not found
120 or incomplete pathname
121
122 __________
123
124 Also see: FSpFileCopy, DirectoryCopy, FSpDirectoryCopy
125 */
126
127 /*****************************************************************************/
128
129 pascal OSErr FSpFileCopy(const FSSpec *srcSpec,
130 const FSSpec *dstSpec,
131 ConstStr255Param copyName,
132 void *copyBufferPtr,
133 long copyBufferSize,
134 Boolean preflight);
135 /* ¦ Duplicate a file and optionally rename it.
136 The FSpFileCopy function duplicates a file and optionally renames it.
137 Since the PBHCopyFile routine is only available on some
138 AFP server volumes under specific conditions, this routine
139 either uses PBHCopyFile, or does all of the work PBHCopyFile
140 does. The srcSpec is used to
141 determine the location of the file to copy. The dstSpec is
142 used to determine the location of the
143 destination directory. If copyName <> NIL, then it points
144 to the name of the new file. If copyBufferPtr <> NIL, it
145 points to a buffer of copyBufferSize that is used to copy
146 the file's data. The larger the supplied buffer, the
147 faster the copy. If copyBufferPtr = NIL, then this routine
148 allocates a buffer in the application heap. If you pass a
149 copy buffer to this routine, make its size a multiple of 512
150 ($200) bytes for optimum performance.
151
152 srcSpec input: An FSSpec record specifying the source file.
153 dstSpec input: An FSSpec record specifying the destination
154 directory.
155 copyName input: Points to the new file name if the file is
156 to be renamed or nil if the file isn't to
157 be renamed.
158 copyBufferPtr input: Points to a buffer of copyBufferSize that
159 is used the i/o buffer for the copy or
160 nil if you want FileCopy to allocate its
161 own buffer in the application heap.
162 copyBufferSize input: The size of the buffer pointed to
163 by copyBufferPtr.
164 preflight input: If true, FSpFileCopy makes sure there are
165 enough allocation blocks on the destination
166 volume to hold both the data and resource forks
167 before starting the copy.
168
169 Result Codes
170 noErr 0 No error
171 readErr Ð19 Driver does not respond to read requests
172 writErr Ð20 Driver does not respond to write requests
173 badUnitErr Ð21 Driver reference number does not
174 match unit table
175 unitEmptyErr Ð22 Driver reference number specifies a
176 nil handle in unit table
177 abortErr Ð27 Request aborted by KillIO
178 notOpenErr Ð28 Driver not open
179 dskFulErr -34 Destination volume is full
180 nsvErr -35 No such volume
181 ioErr -36 I/O error
182 bdNamErr -37 Bad filename
183 tmfoErr -42 Too many files open
184 fnfErr -43 Source file not found, or destination
185 directory does not exist
186 wPrErr -44 Volume locked by hardware
187 fLckdErr -45 File is locked
188 vLckdErr -46 Destination volume is read-only
189 fBsyErr -47 The source or destination file could
190 not be opened with the correct access
191 modes
192 dupFNErr -48 Destination file already exists
193 opWrErr -49 File already open for writing
194 paramErr -50 No default volume or function not
195 supported by volume
196 permErr -54 File is already open and cannot be opened using specified deny modes
197 memFullErr -108 Copy buffer could not be allocated
198 dirNFErr -120 Directory not found or incomplete pathname
199 wrgVolTypErr -123 Function not supported by volume
200 afpAccessDenied -5000 User does not have the correct access
201 afpDenyConflict -5006 The source or destination file could
202 not be opened with the correct access
203 modes
204 afpObjectTypeErr -5025 Source is a directory, directory not found
205 or incomplete pathname
206
207 __________
208
209 Also see: FileCopy, DirectoryCopy, FSpDirectoryCopy
210 */
211
212 /*****************************************************************************/
213
214 #ifdef __cplusplus
215 }
216 #endif
217
218 #include "optimend.h"
219
220 #endif /* __FILECOPY__ */