~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpcom/io/macDirectoryCopy.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
Import upstream version 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
**      Apple Macintosh Developer Technical Support
 
3
**
 
4
**      DirectoryCopy: A robust, general purpose directory copy routine.
 
5
**
 
6
**      by Jim Luther, Apple Developer Technical Support Emeritus
 
7
**
 
8
**      File:           DirectoryCopy.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
// Modified to allow renaming the destination folder
 
23
 
 
24
#ifndef __MACDIRECTORYCOPY__
 
25
#define __MACDIRECTORYCOPY__
 
26
 
 
27
#include <Types.h>
 
28
#include <Files.h>
 
29
 
 
30
#include "Optimization.h"
 
31
 
 
32
#ifdef __cplusplus
 
33
extern "C" {
 
34
#endif
 
35
 
 
36
typedef pascal  Boolean (*CopyErrProcPtr) (OSErr error,
 
37
                                                                                   short failedOperation,
 
38
                                                                                   short srcVRefNum,
 
39
                                                                                   long srcDirID,
 
40
                                                                                   ConstStr255Param srcName,
 
41
                                                                                   short dstVRefNum,
 
42
                                                                                   long dstDirID,
 
43
                                                                                   ConstStr255Param dstName);
 
44
/*      � Prototype for the CopyErrProc function DirectoryCopy calls.
 
45
        This is the prototype for the CopyErrProc function DirectoryCopy
 
46
        calls if an error condition is detected sometime during the copy.  If
 
47
        CopyErrProc returns false, then DirectoryCopy attempts to continue with
 
48
        the directory copy operation.  If CopyErrProc returns true, then
 
49
        DirectoryCopy stops the directory copy operation.
 
50
 
 
51
        error                   input:  The error result code that caused CopyErrProc to
 
52
                                                        be called.
 
53
        failedOperation input:  The operation that returned an error to
 
54
                                                        DirectoryCopy.
 
55
        srcVRefNum              input:  Source volume specification.
 
56
        srcDirID                input:  Source directory ID.
 
57
        srcName                 input:  Source file or directory name, or nil if
 
58
                                                        srcDirID specifies the directory.
 
59
        dstVRefNum              input:  Destination volume specification.
 
60
        dstDirID                input:  Destination directory ID.
 
61
        dstName                 input:  Destination file or directory name, or nil if
 
62
                                                        dstDirID specifies the directory.
 
63
 
 
64
        __________
 
65
        
 
66
        Also see:       FilteredDirectoryCopy, FSpFilteredDirectoryCopy, DirectoryCopy, FSpDirectoryCopy
 
67
*/
 
68
 
 
69
pascal  OSErr   MacFSpDirectoryCopyRename(const FSSpec *srcSpec,
 
70
                                                                 const FSSpec *dstSpec,
 
71
                                                                 ConstStr255Param newName,
 
72
                                                                 void *copyBufferPtr,
 
73
                                                                 long copyBufferSize,
 
74
                                                                 Boolean preflight,
 
75
                                                                 CopyErrProcPtr copyErrHandler);
 
76
/*      � Make a copy of a directory structure in a new location.
 
77
        The FSpDirectoryCopy function makes a copy of a directory structure in a
 
78
        new location. If copyBufferPtr <> NIL, it points to a buffer of
 
79
        copyBufferSize that is used to copy files data.  The larger the
 
80
        supplied buffer, the faster the copy.  If copyBufferPtr = NIL, then this
 
81
        routine allocates a buffer in the application heap. If you pass a
 
82
        copy buffer to this routine, make its size a multiple of 512
 
83
        ($200) bytes for optimum performance.
 
84
        
 
85
        srcSpec                 input:  An FSSpec record specifying the directory to copy.
 
86
        dstSpec                 input:  An FSSpec record specifying destination directory
 
87
                                                        of the copy.
 
88
        copyBufferPtr   input:  Points to a buffer of copyBufferSize that
 
89
                                                        is used the i/o buffer for the copy or
 
90
                                                        nil if you want DirectoryCopy to allocate its
 
91
                                                        own buffer in the application heap.
 
92
        copyBufferSize  input:  The size of the buffer pointed to
 
93
                                                        by copyBufferPtr.
 
94
        preflight               input:  If true, FSpDirectoryCopy makes sure there are
 
95
                                                        enough allocation blocks on the destination
 
96
                                                        volume to hold the directory's files before
 
97
                                                        starting the copy.
 
98
        copyErrHandler  input:  A pointer to the routine you want called if an
 
99
                                                        error condition is detected during the copy, or
 
100
                                                        nil if you don't want to handle error conditions.
 
101
                                                        If you don't handle error conditions, the first
 
102
                                                        error will cause the copy to quit and
 
103
                                                        DirectoryCopy will return the error.
 
104
                                                        Error handling is recommended...
 
105
        
 
106
        Result Codes
 
107
                noErr                           0               No error
 
108
                readErr                         �19             Driver does not respond to read requests
 
109
                writErr                         �20             Driver does not respond to write requests
 
110
                badUnitErr                      �21             Driver reference number does not
 
111
                                                                        match unit table
 
112
                unitEmptyErr            �22             Driver reference number specifies a
 
113
                                                                        nil handle in unit table
 
114
                abortErr                        �27             Request aborted by KillIO
 
115
                notOpenErr                      �28             Driver not open
 
116
                dskFulErr                       -34             Destination volume is full
 
117
                nsvErr                          -35             No such volume
 
118
                ioErr                           -36             I/O error
 
119
                bdNamErr                        -37             Bad filename
 
120
                tmfoErr                         -42             Too many files open
 
121
                fnfErr                          -43             Source file not found, or destination
 
122
                                                                        directory does not exist
 
123
                wPrErr                          -44             Volume locked by hardware
 
124
                fLckdErr                        -45             File is locked
 
125
                vLckdErr                        -46             Destination volume is read-only
 
126
                fBsyErr                         -47             The source or destination file could
 
127
                                                                        not be opened with the correct access
 
128
                                                                        modes
 
129
                dupFNErr                        -48             Destination file already exists
 
130
                opWrErr                         -49             File already open for writing
 
131
                paramErr                        -50             No default volume or function not
 
132
                                                                        supported by volume
 
133
                permErr                         -54             File is already open and cannot be opened using specified deny modes
 
134
                memFullErr                      -108    Copy buffer could not be allocated
 
135
                dirNFErr                        -120    Directory not found or incomplete pathname
 
136
                wrgVolTypErr            -123    Function not supported by volume
 
137
                afpAccessDenied         -5000   User does not have the correct access
 
138
                afpDenyConflict         -5006   The source or destination file could
 
139
                                                                        not be opened with the correct access
 
140
                                                                        modes
 
141
                afpObjectTypeErr        -5025   Source is a directory, directory not found
 
142
                                                                        or incomplete pathname
 
143
        
 
144
        __________
 
145
        
 
146
        Also see:       CopyErrProcPtr, DirectoryCopy, FilteredDirectoryCopy,
 
147
                                FSpFilteredDirectoryCopy, FileCopy, FSpFileCopy
 
148
*/
 
149
 
 
150
/*****************************************************************************/
 
151
 
 
152
#ifdef __cplusplus
 
153
}
 
154
#endif
 
155
 
 
156
#include "OptimizationEnd.h"
 
157
 
 
158
#endif  /* __DIRECTORYCOPY__ */