]> git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/morefile/FSpCompat.h
Generic fix for full row highlight
[wxWidgets.git] / src / mac / classic / morefile / FSpCompat.h
1 /*
2 File: FSpCompat.h
3
4 Contains: FSSpec compatibility functions.
5
6 Version: Technology: MoreFiles
7 Release: 1.5.2
8
9 Copyright: © 1992-2001 by Apple Computer, Inc., all rights reserved.
10
11 Bugs?: For bug reports, consult the following page on
12 the World Wide Web:
13
14 http://developer.apple.com/bugreporter/
15
16 */
17
18 /*
19 You may incorporate this sample code into your applications without
20 restriction, though the sample code has been provided "AS IS" and the
21 responsibility for its operation is 100% yours. However, what you are
22 not permitted to do is to redistribute the source as "DSC Sample Code"
23 after having made changes. If you're going to re-distribute the source,
24 we require that you make it clear in the source that the code was
25 descended from Apple Sample Code, but that you've made changes.
26 */
27
28 #ifndef __FSPCOMPAT__
29 #define __FSPCOMPAT__
30
31 #ifndef __MACTYPES__
32 #include <MacTypes.h>
33 #endif
34
35 #ifndef __FILES__
36 #include <Files.h>
37 #endif
38
39 #include "Optimization.h"
40
41
42 #if PRAGMA_ONCE
43 #pragma once
44 #endif
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 #if PRAGMA_IMPORT
51 #pragma import on
52 #endif
53
54 #if PRAGMA_STRUCT_ALIGN
55 #pragma options align=mac68k
56 #elif PRAGMA_STRUCT_PACKPUSH
57 #pragma pack(push, 2)
58 #elif PRAGMA_STRUCT_PACK
59 #pragma pack(2)
60 #endif
61
62 /*****************************************************************************/
63
64 EXTERN_API( OSErr )
65 FSMakeFSSpecCompat(
66 short vRefNum,
67 long dirID,
68 ConstStr255Param fileName,
69 FSSpec * spec);
70
71
72 /*
73 The FSMakeFSSpecCompat function fills in the fields of an FSSpec record.
74 If the file system can't create the FSSpec, then the compatibility code
75 creates a FSSpec that is exactly like an FSSpec except that spec.name
76 for a file may not have the same capitalization as the file's catalog
77 entry on the disk volume. That is because fileName is parsed to get the
78 name instead of getting the name back from the file system. This works
79 fine with System 6 where FSMakeSpec isn't available.
80
81 vRefNum input: Volume specification.
82 dirID input: Directory ID.
83 fileName input: Pointer to object name, or nil when dirID specifies
84 a directory that's the object.
85 spec output: A file system specification to be filled in by
86 FSMakeFSSpecCompat.
87
88 Result Codes
89 noErr 0 No error
90 nsvErr -35 Volume doesnÕt exist
91 fnfErr -43 File or directory does not exist
92 (FSSpec is still valid)
93 */
94
95 /*****************************************************************************/
96
97 EXTERN_API( OSErr )
98 FSpOpenDFCompat(
99 const FSSpec * spec,
100 char permission,
101 short * refNum);
102
103
104 /*
105 The FSpOpenDFCompat function opens the data fork of the file specified
106 by spec.
107 Differences from FSpOpenDF: If FSpOpenDF isn't available,
108 FSpOpenDFCompat uses PHBOpen because System 6 doesn't support PBHOpenDF.
109 This means FSpOpenDFCompat could accidentally open a driver if the
110 spec->name begins with a period.
111
112 spec input: An FSSpec record specifying the file whose data
113 fork is to be opened.
114 permission input: A constant indicating the desired file access
115 permissions.
116 refNum output: A reference number of an access path to the file's
117 data fork.
118
119 Result Codes
120 noErr 0 No error
121 nsvErr -35 No such volume
122 ioErr -36 I/O error
123 bdNamErr -37 Bad filename
124 tmfoErr -42 Too many files open
125 fnfErr -43 File not found
126 opWrErr -49 File already open for writing
127 permErr -54 Attempt to open locked file for writing
128 dirNFErr -120 Directory not found or incomplete pathname
129 afpAccessDenied -5000 User does not have the correct access to
130 the file
131
132 __________
133
134 See also: FSpOpenAware
135 */
136
137 /*****************************************************************************/
138
139 EXTERN_API( OSErr )
140 FSpOpenRFCompat(
141 const FSSpec * spec,
142 char permission,
143 short * refNum);
144
145
146 /*
147 The FSpOpenRFCompat function opens the resource fork of the file
148 specified by spec.
149
150 spec input: An FSSpec record specifying the file whose resource
151 fork is to be opened.
152 permission input: A constant indicating the desired file access
153 permissions.
154 refNum output: A reference number of an access path to the file's
155 resource fork.
156
157 Result Codes
158 noErr 0 No error
159 nsvErr -35 No such volume
160 ioErr -36 I/O error
161 bdNamErr -37 Bad filename
162 tmfoErr -42 Too many files open
163 fnfErr -43 File not found
164 opWrErr -49 File already open for writing
165 permErr -54 Attempt to open locked file for writing
166 dirNFErr -120 Directory not found or incomplete pathname
167 afpAccessDenied -5000 User does not have the correct access to
168 the file
169
170 __________
171
172 See also: FSpOpenRFAware
173 */
174
175 /*****************************************************************************/
176
177 EXTERN_API( OSErr )
178 FSpCreateCompat(
179 const FSSpec * spec,
180 OSType creator,
181 OSType fileType,
182 ScriptCode scriptTag);
183
184
185 /*
186 The FSpCreateCompat function creates a new file with the specified
187 type, creator, and script code.
188 Differences from FSpCreate: FSpCreateCompat correctly sets the
189 fdScript in the file's FXInfo record to scriptTag if the problem
190 isn't fixed in the File Manager code.
191
192 spec input: An FSSpec record specifying the file to create.
193 creator input: The creator of the new file.
194 fileType input The file type of the new file.
195 scriptCode input: The code of the script system in which the file
196 name is to be displayed.
197
198 Result Codes
199 noErr 0 No error
200 dirFulErr -33 File directory full
201 dskFulErr -34 Disk is full
202 nsvErr -35 No such volume
203 ioErr -36 I/O error
204 bdNamErr -37 Bad filename
205 fnfErr -43 Directory not found or incomplete pathname
206 wPrErr -44 Hardware volume lock
207 vLckdErr -46 Software volume lock
208 dupFNErr -48 Duplicate filename and version
209 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
210 afpAccessDenied -5000 User does not have the correct access
211 afpObjectTypeErr -5025 A directory exists with that name
212 */
213
214 /*****************************************************************************/
215
216 EXTERN_API( OSErr )
217 FSpDirCreateCompat(
218 const FSSpec * spec,
219 ScriptCode scriptTag,
220 long * createdDirID);
221
222
223 /*
224 The FSpDirCreateCompat function creates a new directory and returns the
225 directory ID of the newDirectory.
226
227 spec input: An FSSpec record specifying the directory to
228 create.
229 scriptCode input: The code of the script system in which the
230 directory name is to be displayed.
231 createdDirID output: The directory ID of the directory that was
232 created.
233
234 Result Codes
235 noErr 0 No error
236 dirFulErr -33 File directory full
237 dskFulErr -34 Disk is full
238 nsvErr -35 No such volume
239 ioErr -36 I/O error
240 bdNamErr -37 Bad filename
241 fnfErr -43 Directory not found or incomplete pathname
242 wPrErr -44 Hardware volume lock
243 vLckdErr -46 Software volume lock
244 dupFNErr -48 Duplicate filename and version
245 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
246 wrgVolTypErr -123 Not an HFS volume
247 afpAccessDenied -5000 User does not have the correct access
248 */
249
250 /*****************************************************************************/
251
252 EXTERN_API( OSErr )
253 FSpDeleteCompat(const FSSpec * spec);
254
255
256 /*
257 The FSpDeleteCompat function deletes a file or directory.
258
259 spec input: An FSSpec record specifying the file or
260 directory to delete.
261
262 Result Codes
263 noErr 0 No error
264 nsvErr -35 No such volume
265 ioErr -36 I/O error
266 bdNamErr -37 Bad filename
267 fnfErr -43 File not found
268 wPrErr -44 Hardware volume lock
269 fLckdErr -45 File is locked
270 vLckdErr -46 Software volume lock
271 fBsyErr -47 File busy, directory not empty, or
272 working directory control block open
273 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
274 afpAccessDenied -5000 User does not have the correct access
275 */
276
277 /*****************************************************************************/
278
279 EXTERN_API( OSErr )
280 FSpGetFInfoCompat(
281 const FSSpec * spec,
282 FInfo * fndrInfo);
283
284
285 /*
286 The FSpGetFInfoCompat function gets the finder information for a file.
287
288 spec input: An FSSpec record specifying the file.
289 fndrInfo output: If the object is a file, then its FInfo.
290
291 Result Codes
292 noErr 0 No error
293 nsvErr -35 No such volume
294 ioErr -36 I/O error
295 bdNamErr -37 Bad filename
296 fnfErr -43 File not found
297 paramErr -50 No default volume
298 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
299 afpAccessDenied -5000 User does not have the correct access
300 afpObjectTypeErr -5025 Directory not found or incomplete pathname
301
302 __________
303
304 Also see: FSpGetDInfo
305 */
306
307 /*****************************************************************************/
308
309 EXTERN_API( OSErr )
310 FSpSetFInfoCompat(
311 const FSSpec * spec,
312 const FInfo * fndrInfo);
313
314
315 /*
316 The FSpSetFInfoCompat function sets the finder information for a file.
317
318 spec input: An FSSpec record specifying the file.
319 fndrInfo input: The FInfo.
320
321 Result Codes
322 noErr 0 No error
323 nsvErr -35 No such volume
324 ioErr -36 I/O error
325 bdNamErr -37 Bad filename
326 fnfErr -43 File not found
327 wPrErr -44 Hardware volume lock
328 fLckdErr -45 File is locked
329 vLckdErr -46 Software volume lock
330 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
331 afpAccessDenied -5000 User does not have the correct access
332 afpObjectTypeErr -5025 Object was a directory
333
334 __________
335
336 Also see: FSpSetDInfo
337 */
338
339 /*****************************************************************************/
340
341 EXTERN_API( OSErr )
342 FSpSetFLockCompat(const FSSpec * spec);
343
344
345 /*
346 The FSpSetFLockCompat function locks a file.
347
348 spec input: An FSSpec record specifying the file.
349
350 Result Codes
351 noErr 0 No error
352 nsvErr -35 No such volume
353 ioErr -36 I/O error
354 fnfErr -43 File not found
355 wPrErr -44 Hardware volume lock
356 vLckdErr -46 Software volume lock
357 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
358 afpAccessDenied -5000 User does not have the correct access to
359 the file
360 afpObjectTypeErr -5025 Folder locking not supported by volume
361 */
362
363 /*****************************************************************************/
364
365 EXTERN_API( OSErr )
366 FSpRstFLockCompat(const FSSpec * spec);
367
368
369 /*
370 The FSpRstFLockCompat function unlocks a file.
371
372 spec input: An FSSpec record specifying the file.
373
374 Result Codes
375 noErr 0 No error
376 nsvErr -35 No such volume
377 ioErr -36 I/O error
378 fnfErr -43 File not found
379 wPrErr -44 Hardware volume lock
380 vLckdErr -46 Software volume lock
381 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
382 afpAccessDenied -5000 User does not have the correct access to
383 the file
384 afpObjectTypeErr -5025 Folder locking not supported by volume
385 */
386
387 /*****************************************************************************/
388
389 EXTERN_API( OSErr )
390 FSpRenameCompat(
391 const FSSpec * spec,
392 ConstStr255Param newName);
393
394
395 /*
396 The FSpRenameCompat function renames a file or directory.
397
398 spec input: An FSSpec record specifying the file.
399 newName input: The new name of the file or directory.
400
401 Result Codes
402 noErr 0 No error
403 dirFulErr -33 File directory full
404 dskFulErr -34 Volume is full
405 nsvErr -35 No such volume
406 ioErr -36 I/O error
407 bdNamErr -37 Bad filename
408 fnfErr -43 File not found
409 wPrErr -44 Hardware volume lock
410 fLckdErr -45 File is locked
411 vLckdErr -46 Software volume lock
412 dupFNErr -48 Duplicate filename and version
413 paramErr -50 No default volume
414 fsRnErr -59 Problem during rename
415 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
416 afpAccessDenied -5000 User does not have the correct access to
417 the file
418 */
419
420 /*****************************************************************************/
421
422 EXTERN_API( OSErr )
423 FSpCatMoveCompat(
424 const FSSpec * source,
425 const FSSpec * dest);
426
427
428 /*
429 The FSpCatMoveCompat function moves a file or directory to a different
430 location on on the same volume.
431
432 source input: An FSSpec record specifying the file or directory.
433 dest input: An FSSpec record specifying the name and location
434 of the directory into which the source file or
435 directory is to be moved.
436
437 Result Codes
438 noErr 0 No error
439 nsvErr -35 No such volume
440 ioErr -36 I/O error
441 bdNamErr -37 Bad filename or attempt to move into
442 a file
443 fnfErr -43 File not found
444 wPrErr -44 Hardware volume lock
445 fLckdErr -45 Target directory is locked
446 vLckdErr -46 Software volume lock
447 dupFNErr -48 Duplicate filename and version
448 paramErr -50 No default volume
449 badMovErr -122 Attempt to move into offspring
450 wrgVolTypErr -123 Not an HFS volume
451 afpAccessDenied -5000 User does not have the correct access to
452 the file
453 */
454
455 /*****************************************************************************/
456
457 EXTERN_API( OSErr )
458 FSpExchangeFilesCompat(
459 const FSSpec * source,
460 const FSSpec * dest);
461
462
463 /*
464 The FSpExchangeFilesCompat function swaps the data in two files by
465 changing the information in the volume's catalog and, if the files
466 are open, in the file control blocks.
467 Differences from FSpExchangeFiles: Correctly exchanges files on volumes
468 that don't support PBExchangeFiles. FSpExchangeFiles attempts to support
469 volumes that don't support PBExchangeFiles, but in System 7, 7.0.1, 7.1,
470 and 7 Pro, the compatibility code just doesn't work on volumes that
471 don't support PBExchangeFiles (even though you may get a noErr result).
472 System Update 3.0 and System 7.5 and later have the problems in
473 FSpExchangeFiles corrected.
474
475 Result Codes
476 noErr 0 No error
477 nsvErr -35 Volume not found
478 ioErr -36 I/O error
479 fnfErr -43 File not found
480 fLckdErr -45 File is locked
481 vLckdErr -46 Volume is locked or read-only
482 paramErr -50 Function not supported by volume
483 volOfflinErr -53 Volume is offline
484 wrgVolTypErr -123 Not an HFS volume
485 diffVolErr -1303 Files on different volumes
486 afpAccessDenied -5000 User does not have the correct access
487 afpObjectTypeErr -5025 Object is a directory, not a file
488 afpSameObjectErr -5038 Source and destination files are the same
489 */
490
491 /*****************************************************************************/
492
493 EXTERN_API( short )
494 FSpOpenResFileCompat(
495 const FSSpec * spec,
496 SignedByte permission);
497
498
499 /*
500 The FSpOpenResFileCompat function opens the resource file specified
501 by spec.
502
503 spec input: An FSSpec record specifying the file whose
504 resource file is to be opened.
505 permission input: A constant indicating the desired file access
506 permissions.
507 function result output: A resource file reference number, or if there's
508 an error -1.
509
510 Result Codes
511 noErr 0 No error
512 nsvErr Ð35 No such volume
513 ioErr Ð36 I/O error
514 bdNamErr Ð37 Bad filename or volume name (perhaps zero
515 length)
516 eofErr Ð39 End of file
517 tmfoErr Ð42 Too many files open
518 fnfErr Ð43 File not found
519 opWrErr Ð49 File already open with write permission
520 permErr Ð54 Permissions error (on file open)
521 extFSErr Ð58 Volume belongs to an external file system
522 memFullErr Ð108 Not enough room in heap zone
523 dirNFErr Ð120 Directory not found
524 mapReadErr Ð199 Map inconsistent with operation
525 */
526
527 /*****************************************************************************/
528
529 EXTERN_API( void )
530 FSpCreateResFileCompat(
531 const FSSpec * spec,
532 OSType creator,
533 OSType fileType,
534 ScriptCode scriptTag);
535
536
537 /*
538 The FSpCreateResFileCompat function creates a new resource file with
539 the specified type, creator, and script code.
540 Differences from FSpCreateResFile: FSpCreateResFileCompat correctly
541 sets the fdScript in the file's FXInfo record to scriptTag if the
542 problem isn't fixed in the File Manager code.
543
544 spec input: An FSSpec record specifying the resource file to create.
545 creator input: The creator of the new file.
546 fileType input The file type of the new file.
547 scriptCode input: The code of the script system in which the file
548 name is to be displayed.
549
550 Result Codes
551 noErr 0 No error
552 dirFulErr Ð33 Directory full
553 dskFulErr Ð34 Disk full
554 nsvErr Ð35 No such volume
555 ioErr Ð36 I/O error
556 bdNamErr Ð37 Bad filename or volume name (perhaps zero
557 length)
558 tmfoErr Ð42 Too many files open
559 wPrErrw Ð44 Disk is write-protected
560 fLckdErr Ð45 File is locked
561 */
562
563 /*****************************************************************************/
564
565 #include "OptimizationEnd.h"
566
567 #if PRAGMA_STRUCT_ALIGN
568 #pragma options align=reset
569 #elif PRAGMA_STRUCT_PACKPUSH
570 #pragma pack(pop)
571 #elif PRAGMA_STRUCT_PACK
572 #pragma pack()
573 #endif
574
575 #ifdef PRAGMA_IMPORT_OFF
576 #pragma import off
577 #elif PRAGMA_IMPORT
578 #pragma import reset
579 #endif
580
581 #ifdef __cplusplus
582 }
583 #endif
584
585 #endif /* __FSPCOMPAT__ */
586