Back to index

lightning-sunbird  0.9+nobinonly
macDirectoryCopy.h
Go to the documentation of this file.
00001 /*
00002 **     Apple Macintosh Developer Technical Support
00003 **
00004 **     DirectoryCopy: A robust, general purpose directory copy routine.
00005 **
00006 **     by Jim Luther, Apple Developer Technical Support Emeritus
00007 **
00008 **     File:         DirectoryCopy.h
00009 **
00010 **     Copyright  1992-1998 Apple Computer, Inc.
00011 **     All rights reserved.
00012 **
00013 **     You may incorporate this sample code into your applications without
00014 **     restriction, though the sample code has been provided "AS IS" and the
00015 **     responsibility for its operation is 100% yours.  However, what you are
00016 **     not permitted to do is to redistribute the source as "DSC Sample Code"
00017 **     after having made changes. If you're going to re-distribute the source,
00018 **     we require that you make it clear in the source that the code was
00019 **     descended from Apple Sample Code, but that you've made changes.
00020 */
00021 
00022 // Modified to allow renaming the destination folder
00023 
00024 #ifndef __MACDIRECTORYCOPY__
00025 #define __MACDIRECTORYCOPY__
00026 
00027 #include <Types.h>
00028 #include <Files.h>
00029 
00030 #include "Optimization.h"
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 typedef       pascal Boolean       (*CopyErrProcPtr) (OSErr error,
00037                                                                          short failedOperation,
00038                                                                          short srcVRefNum,
00039                                                                          long srcDirID,
00040                                                                          ConstStr255Param srcName,
00041                                                                          short dstVRefNum,
00042                                                                          long dstDirID,
00043                                                                          ConstStr255Param dstName);
00044 /*      Prototype for the CopyErrProc function DirectoryCopy calls.
00045        This is the prototype for the CopyErrProc function DirectoryCopy
00046        calls if an error condition is detected sometime during the copy.  If
00047        CopyErrProc returns false, then DirectoryCopy attempts to continue with
00048        the directory copy operation.  If CopyErrProc returns true, then
00049        DirectoryCopy stops the directory copy operation.
00050 
00051        error                input: The error result code that caused CopyErrProc to
00052                                                  be called.
00053        failedOperation      input: The operation that returned an error to
00054                                                  DirectoryCopy.
00055        srcVRefNum           input: Source volume specification.
00056        srcDirID             input: Source directory ID.
00057        srcName                     input: Source file or directory name, or nil if
00058                                                  srcDirID specifies the directory.
00059        dstVRefNum           input: Destination volume specification.
00060        dstDirID             input: Destination directory ID.
00061        dstName                     input: Destination file or directory name, or nil if
00062                                                  dstDirID specifies the directory.
00063 
00064        __________
00065        
00066        Also see:     FilteredDirectoryCopy, FSpFilteredDirectoryCopy, DirectoryCopy, FSpDirectoryCopy
00067 */
00068 
00069 pascal OSErr  MacFSpDirectoryCopyRename(const FSSpec *srcSpec,
00070                                                          const FSSpec *dstSpec,
00071                                                          ConstStr255Param newName,
00072                                                          void *copyBufferPtr,
00073                                                          long copyBufferSize,
00074                                                          Boolean preflight,
00075                                                          CopyErrProcPtr copyErrHandler);
00076 /*      Make a copy of a directory structure in a new location.
00077        The FSpDirectoryCopy function makes a copy of a directory structure in a
00078        new location. If copyBufferPtr <> NIL, it points to a buffer of
00079        copyBufferSize that is used to copy files data.  The larger the
00080        supplied buffer, the faster the copy.  If copyBufferPtr = NIL, then this
00081        routine allocates a buffer in the application heap. If you pass a
00082        copy buffer to this routine, make its size a multiple of 512
00083        ($200) bytes for optimum performance.
00084        
00085        srcSpec                     input: An FSSpec record specifying the directory to copy.
00086        dstSpec                     input: An FSSpec record specifying destination directory
00087                                                  of the copy.
00088        copyBufferPtr input: Points to a buffer of copyBufferSize that
00089                                                  is used the i/o buffer for the copy or
00090                                                  nil if you want DirectoryCopy to allocate its
00091                                                  own buffer in the application heap.
00092        copyBufferSize       input: The size of the buffer pointed to
00093                                                  by copyBufferPtr.
00094        preflight            input: If true, FSpDirectoryCopy makes sure there are
00095                                                  enough allocation blocks on the destination
00096                                                  volume to hold the directory's files before
00097                                                  starting the copy.
00098        copyErrHandler       input: A pointer to the routine you want called if an
00099                                                  error condition is detected during the copy, or
00100                                                  nil if you don't want to handle error conditions.
00101                                                  If you don't handle error conditions, the first
00102                                                  error will cause the copy to quit and
00103                                                  DirectoryCopy will return the error.
00104                                                  Error handling is recommended...
00105        
00106        Result Codes
00107               noErr                       0             No error
00108               readErr                            19           Driver does not respond to read requests
00109               writErr                            20           Driver does not respond to write requests
00110               badUnitErr                  21           Driver reference number does not
00111                                                                match unit table
00112               unitEmptyErr         22           Driver reference number specifies a
00113                                                                nil handle in unit table
00114               abortErr                    27           Request aborted by KillIO
00115               notOpenErr                  28           Driver not open
00116               dskFulErr                   -34           Destination volume is full
00117               nsvErr                      -35           No such volume
00118               ioErr                       -36           I/O error
00119               bdNamErr                    -37           Bad filename
00120               tmfoErr                            -42           Too many files open
00121               fnfErr                      -43           Source file not found, or destination
00122                                                                directory does not exist
00123               wPrErr                      -44           Volume locked by hardware
00124               fLckdErr                    -45           File is locked
00125               vLckdErr                    -46           Destination volume is read-only
00126               fBsyErr                            -47           The source or destination file could
00127                                                                not be opened with the correct access
00128                                                                modes
00129               dupFNErr                    -48           Destination file already exists
00130               opWrErr                            -49           File already open for writing
00131               paramErr                    -50           No default volume or function not
00132                                                                supported by volume
00133               permErr                            -54           File is already open and cannot be opened using specified deny modes
00134               memFullErr                  -108   Copy buffer could not be allocated
00135               dirNFErr                    -120   Directory not found or incomplete pathname
00136               wrgVolTypErr         -123   Function not supported by volume
00137               afpAccessDenied             -5000  User does not have the correct access
00138               afpDenyConflict             -5006  The source or destination file could
00139                                                                not be opened with the correct access
00140                                                                modes
00141               afpObjectTypeErr     -5025  Source is a directory, directory not found
00142                                                                or incomplete pathname
00143        
00144        __________
00145        
00146        Also see:     CopyErrProcPtr, DirectoryCopy, FilteredDirectoryCopy,
00147                             FSpFilteredDirectoryCopy, FileCopy, FSpFileCopy
00148 */
00149 
00150 /*****************************************************************************/
00151 
00152 #ifdef __cplusplus
00153 }
00154 #endif
00155 
00156 #include "OptimizationEnd.h"
00157 
00158 #endif /* __DIRECTORYCOPY__ */