]> git.saurik.com Git - wxWidgets.git/blob - src/mac/morefile/FSpCompa.h
more reasonable default size
[wxWidgets.git] / src / mac / morefile / FSpCompa.h
1 /*
2 ** Apple Macintosh Developer Technical Support
3 **
4 ** FSSpec compatibility functions.
5 **
6 ** by Jim Luther, Apple Developer Technical Support Emeritus
7 **
8 ** File: FSpCompat.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 __FSPCOMPAT__
23 #define __FSPCOMPAT__
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 FSMakeFSSpecCompat(short vRefNum,
37 long dirID,
38 ConstStr255Param fileName,
39 FSSpec *spec);
40 /* ¦ Initialize a FSSpec record.
41 The FSMakeFSSpecCompat function fills in the fields of an FSSpec record.
42 If the file system can't create the FSSpec, then the compatibility code
43 creates a FSSpec that is exactly like an FSSpec except that spec.name
44 for a file may not have the same capitalization as the file's catalog
45 entry on the disk volume. That is because fileName is parsed to get the
46 name instead of getting the name back from the file system. This works
47 fine with System 6 where FSMakeSpec isn't available.
48
49 vRefNum input: Volume specification.
50 dirID input: Directory ID.
51 fileName input: Pointer to object name, or nil when dirID specifies
52 a directory that's the object.
53 spec output: A file system specification to be filled in by
54 FSMakeFSSpecCompat.
55
56 Result Codes
57 noErr 0 No error
58 nsvErr -35 Volume doesnÕt exist
59 fnfErr -43 File or directory does not exist
60 (FSSpec is still valid)
61 */
62
63 /*****************************************************************************/
64
65 pascal OSErr FSpOpenDFCompat(const FSSpec *spec,
66 char permission,
67 short *refNum);
68 /* ¦ Open a file's data fork.
69 The FSpOpenDFCompat function opens the data fork of the file specified
70 by spec.
71 Differences from FSpOpenDF: If FSpOpenDF isn't available,
72 FSpOpenDFCompat uses PHBOpen because System 6 doesn't support PBHOpenDF.
73 This means FSpOpenDFCompat could accidentally open a driver if the
74 spec->name begins with a period.
75
76 spec input: An FSSpec record specifying the file whose data
77 fork is to be opened.
78 permission input: A constant indicating the desired file access
79 permissions.
80 refNum output: A reference number of an access path to the file's
81 data fork.
82
83 Result Codes
84 noErr 0 No error
85 nsvErr -35 No such volume
86 ioErr -36 I/O error
87 bdNamErr -37 Bad filename
88 tmfoErr -42 Too many files open
89 fnfErr -43 File not found
90 opWrErr -49 File already open for writing
91 permErr -54 Attempt to open locked file for writing
92 dirNFErr -120 Directory not found or incomplete pathname
93 afpAccessDenied -5000 User does not have the correct access to
94 the file
95
96 __________
97
98 See also: FSpOpenAware
99 */
100
101 /*****************************************************************************/
102
103 pascal OSErr FSpOpenRFCompat(const FSSpec *spec,
104 char permission,
105 short *refNum);
106 /* ¦ Open a file's resource fork.
107 The FSpOpenRFCompat function opens the resource fork of the file
108 specified by spec.
109
110 spec input: An FSSpec record specifying the file whose resource
111 fork is to be opened.
112 permission input: A constant indicating the desired file access
113 permissions.
114 refNum output: A reference number of an access path to the file's
115 resource fork.
116
117 Result Codes
118 noErr 0 No error
119 nsvErr -35 No such volume
120 ioErr -36 I/O error
121 bdNamErr -37 Bad filename
122 tmfoErr -42 Too many files open
123 fnfErr -43 File not found
124 opWrErr -49 File already open for writing
125 permErr -54 Attempt to open locked file for writing
126 dirNFErr -120 Directory not found or incomplete pathname
127 afpAccessDenied -5000 User does not have the correct access to
128 the file
129
130 __________
131
132 See also: FSpOpenRFAware
133 */
134
135
136 /*****************************************************************************/
137
138 pascal OSErr FSpCreateCompat(const FSSpec *spec,
139 OSType creator,
140 OSType fileType,
141 ScriptCode scriptTag);
142 /* ¦ Create a new file.
143 The FSpCreateCompat function creates a new file with the specified
144 type, creator, and script code.
145 Differences from FSpCreate: FSpCreateCompat correctly sets the
146 fdScript in the file's FXInfo record to scriptTag if the problem
147 isn't fixed in the File Manager code.
148
149 spec input: An FSSpec record specifying the file to create.
150 creator input: The creator of the new file.
151 fileType input The file type of the new file.
152 scriptCode input: The code of the script system in which the file
153 name is to be displayed.
154
155 Result Codes
156 noErr 0 No error
157 dirFulErr -33 File directory full
158 dskFulErr -34 Disk is full
159 nsvErr -35 No such volume
160 ioErr -36 I/O error
161 bdNamErr -37 Bad filename
162 fnfErr -43 Directory not found or incomplete pathname
163 wPrErr -44 Hardware volume lock
164 vLckdErr -46 Software volume lock
165 dupFNErr -48 Duplicate filename and version
166 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
167 afpAccessDenied -5000 User does not have the correct access
168 afpObjectTypeErr -5025 A directory exists with that name
169 */
170
171 /*****************************************************************************/
172
173 pascal OSErr FSpDirCreateCompat(const FSSpec *spec,
174 ScriptCode scriptTag,
175 long *createdDirID);
176 /* ¦ Create a new directory.
177 The FSpDirCreateCompat function creates a new directory and returns the
178 directory ID of the newDirectory.
179
180 spec input: An FSSpec record specifying the directory to
181 create.
182 scriptCode input: The code of the script system in which the
183 directory name is to be displayed.
184 createdDirID output: The directory ID of the directory that was
185 created.
186
187 Result Codes
188 noErr 0 No error
189 dirFulErr -33 File directory full
190 dskFulErr -34 Disk is full
191 nsvErr -35 No such volume
192 ioErr -36 I/O error
193 bdNamErr -37 Bad filename
194 fnfErr -43 Directory not found or incomplete pathname
195 wPrErr -44 Hardware volume lock
196 vLckdErr -46 Software volume lock
197 dupFNErr -48 Duplicate filename and version
198 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
199 wrgVolTypErr -123 Not an HFS volume
200 afpAccessDenied -5000 User does not have the correct access
201 */
202
203 /*****************************************************************************/
204
205 pascal OSErr FSpDeleteCompat(const FSSpec *spec);
206 /* ¦ Delete a file or directory.
207 The FSpDeleteCompat function deletes a file or directory.
208
209 spec input: An FSSpec record specifying the file or
210 directory to delete.
211
212 Result Codes
213 noErr 0 No error
214 nsvErr -35 No such volume
215 ioErr -36 I/O error
216 bdNamErr -37 Bad filename
217 fnfErr -43 File not found
218 wPrErr -44 Hardware volume lock
219 fLckdErr -45 File is locked
220 vLckdErr -46 Software volume lock
221 fBsyErr -47 File busy, directory not empty, or
222 working directory control block open
223 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
224 afpAccessDenied -5000 User does not have the correct access
225 */
226
227 /*****************************************************************************/
228
229 pascal OSErr FSpGetFInfoCompat(const FSSpec *spec,
230 FInfo *fndrInfo);
231 /* ¦ Get the finder information for a file.
232 The FSpGetFInfoCompat function gets the finder information for a file.
233
234 spec input: An FSSpec record specifying the file.
235 fndrInfo output: If the object is a file, then its FInfo.
236
237 Result Codes
238 noErr 0 No error
239 nsvErr -35 No such volume
240 ioErr -36 I/O error
241 bdNamErr -37 Bad filename
242 fnfErr -43 File not found
243 paramErr -50 No default volume
244 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
245 afpAccessDenied -5000 User does not have the correct access
246 afpObjectTypeErr -5025 Directory not found or incomplete pathname
247
248 __________
249
250 Also see: FSpGetDInfo
251 */
252
253 /*****************************************************************************/
254
255 pascal OSErr FSpSetFInfoCompat(const FSSpec *spec,
256 const FInfo *fndrInfo);
257 /* ¦ Set the finder information for a file.
258 The FSpSetFInfoCompat function sets the finder information for a file.
259
260 spec input: An FSSpec record specifying the file.
261 fndrInfo input: The FInfo.
262
263 Result Codes
264 noErr 0 No error
265 nsvErr -35 No such volume
266 ioErr -36 I/O error
267 bdNamErr -37 Bad filename
268 fnfErr -43 File not found
269 wPrErr -44 Hardware volume lock
270 fLckdErr -45 File is locked
271 vLckdErr -46 Software volume lock
272 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
273 afpAccessDenied -5000 User does not have the correct access
274 afpObjectTypeErr -5025 Object was a directory
275
276 __________
277
278 Also see: FSpSetDInfo
279 */
280
281 /*****************************************************************************/
282
283 pascal OSErr FSpSetFLockCompat(const FSSpec *spec);
284 /* ¦ Lock a file.
285 The FSpSetFLockCompat function locks a file.
286
287 spec input: An FSSpec record specifying the file.
288
289 Result Codes
290 noErr 0 No error
291 nsvErr -35 No such volume
292 ioErr -36 I/O error
293 fnfErr -43 File not found
294 wPrErr -44 Hardware volume lock
295 vLckdErr -46 Software volume lock
296 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
297 afpAccessDenied -5000 User does not have the correct access to
298 the file
299 afpObjectTypeErr -5025 Folder locking not supported by volume
300 */
301
302 /*****************************************************************************/
303
304 pascal OSErr FSpRstFLockCompat(const FSSpec *spec);
305 /* ¦ Unlock a file.
306 The FSpRstFLockCompat function unlocks a file.
307
308 spec input: An FSSpec record specifying the file.
309
310 Result Codes
311 noErr 0 No error
312 nsvErr -35 No such volume
313 ioErr -36 I/O error
314 fnfErr -43 File not found
315 wPrErr -44 Hardware volume lock
316 vLckdErr -46 Software volume lock
317 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
318 afpAccessDenied -5000 User does not have the correct access to
319 the file
320 afpObjectTypeErr -5025 Folder locking not supported by volume
321 */
322
323 /*****************************************************************************/
324
325 pascal OSErr FSpRenameCompat(const FSSpec *spec,
326 ConstStr255Param newName);
327 /* ¦ Rename a file or directory.
328 The FSpRenameCompat function renames a file or directory.
329
330 spec input: An FSSpec record specifying the file.
331 newName input: The new name of the file or directory.
332
333 Result Codes
334 noErr 0 No error
335 dirFulErr -33 File directory full
336 dskFulErr -34 Volume is full
337 nsvErr -35 No such volume
338 ioErr -36 I/O error
339 bdNamErr -37 Bad filename
340 fnfErr -43 File not found
341 wPrErr -44 Hardware volume lock
342 fLckdErr -45 File is locked
343 vLckdErr -46 Software volume lock
344 dupFNErr -48 Duplicate filename and version
345 paramErr -50 No default volume
346 fsRnErr -59 Problem during rename
347 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
348 afpAccessDenied -5000 User does not have the correct access to
349 the file
350 */
351
352 /*****************************************************************************/
353
354 pascal OSErr FSpCatMoveCompat(const FSSpec *source,
355 const FSSpec *dest);
356 /* ¦ Move a file or directory to a different location on on the same volume.
357 The FSpCatMoveCompat function moves a file or directory to a different
358 location on on the same volume.
359
360 source input: An FSSpec record specifying the file or directory.
361 dest input: An FSSpec record specifying the name and location
362 of the directory into which the source file or
363 directory is to be moved.
364
365 Result Codes
366 noErr 0 No error
367 nsvErr -35 No such volume
368 ioErr -36 I/O error
369 bdNamErr -37 Bad filename or attempt to move into
370 a file
371 fnfErr -43 File not found
372 wPrErr -44 Hardware volume lock
373 fLckdErr -45 Target directory is locked
374 vLckdErr -46 Software volume lock
375 dupFNErr -48 Duplicate filename and version
376 paramErr -50 No default volume
377 badMovErr -122 Attempt to move into offspring
378 wrgVolTypErr -123 Not an HFS volume
379 afpAccessDenied -5000 User does not have the correct access to
380 the file
381 */
382
383 /*****************************************************************************/
384
385 pascal OSErr FSpExchangeFilesCompat(const FSSpec *source,
386 const FSSpec *dest);
387 /* ¦ Exchange the data stored in two files on the same volume.
388 The FSpExchangeFilesCompat function swaps the data in two files by
389 changing the information in the volume's catalog and, if the files
390 are open, in the file control blocks.
391 Differences from FSpExchangeFiles: Correctly exchanges files on volumes
392 that don't support PBExchangeFiles. FSpExchangeFiles attempts to support
393 volumes that don't support PBExchangeFiles, but in System 7, 7.0.1, 7.1,
394 and 7 Pro, the compatibility code just doesn't work on volumes that
395 don't support PBExchangeFiles (even though you may get a noErr result).
396 System Update 3.0 and System 7.5 and later have the problems in
397 FSpExchangeFiles corrected.
398
399 Result Codes
400 noErr 0 No error
401 nsvErr -35 Volume not found
402 ioErr -36 I/O error
403 fnfErr -43 File not found
404 fLckdErr -45 File is locked
405 vLckdErr -46 Volume is locked or read-only
406 paramErr -50 Function not supported by volume
407 volOfflinErr -53 Volume is offline
408 wrgVolTypErr -123 Not an HFS volume
409 diffVolErr -1303 Files on different volumes
410 afpAccessDenied -5000 User does not have the correct access
411 afpObjectTypeErr -5025 Object is a directory, not a file
412 afpSameObjectErr -5038 Source and destination files are the same
413 */
414
415 /*****************************************************************************/
416
417 pascal short FSpOpenResFileCompat(const FSSpec *spec,
418 SignedByte permission);
419 /* ¦ Open a file's resource file.
420 The FSpOpenResFileCompat function opens the resource file specified
421 by spec.
422
423 spec input: An FSSpec record specifying the file whose
424 resource file is to be opened.
425 permission input: A constant indicating the desired file access
426 permissions.
427 function result output: A resource file reference number, or if there's
428 an error -1.
429
430 Result Codes
431 noErr 0 No error
432 nsvErr Ð35 No such volume
433 ioErr Ð36 I/O error
434 bdNamErr Ð37 Bad filename or volume name (perhaps zero
435 length)
436 eofErr Ð39 End of file
437 tmfoErr Ð42 Too many files open
438 fnfErr Ð43 File not found
439 opWrErr Ð49 File already open with write permission
440 permErr Ð54 Permissions error (on file open)
441 extFSErr Ð58 Volume belongs to an external file system
442 memFullErr Ð108 Not enough room in heap zone
443 dirNFErr Ð120 Directory not found
444 mapReadErr Ð199 Map inconsistent with operation
445 */
446
447 /*****************************************************************************/
448
449 pascal void FSpCreateResFileCompat(const FSSpec *spec,
450 OSType creator,
451 OSType fileType,
452 ScriptCode scriptTag);
453 /* ¦ Create a resource file.
454 The FSpCreateResFileCompat function creates a new resource file with
455 the specified type, creator, and script code.
456 Differences from FSpCreateResFile: FSpCreateResFileCompat correctly
457 sets the fdScript in the file's FXInfo record to scriptTag if the
458 problem isn't fixed in the File Manager code.
459
460 spec input: An FSSpec record specifying the resource file to create.
461 creator input: The creator of the new file.
462 fileType input The file type of the new file.
463 scriptCode input: The code of the script system in which the file
464 name is to be displayed.
465
466 Result Codes
467 noErr 0 No error
468 dirFulErr Ð33 Directory full
469 dskFulErr Ð34 Disk full
470 nsvErr Ð35 No such volume
471 ioErr Ð36 I/O error
472 bdNamErr Ð37 Bad filename or volume name (perhaps zero
473 length)
474 tmfoErr Ð42 Too many files open
475 wPrErrw Ð44 Disk is write-protected
476 fLckdErr Ð45 File is locked
477 */
478
479 /*****************************************************************************/
480
481 #ifdef __cplusplus
482 }
483 #endif
484
485 #include "OptimEnd.h"
486
487 #endif /* __FSPCOMPAT__ */
488