Back to index

lightning-sunbird  0.9+nobinonly
Defines | Typedefs | Functions
FSCopyObject.h File Reference
#include <Files.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define DEBUG_COPY_OBJECT   0
#define QuoteExceptionString(x)   #x
#define mycheck(assertion)
#define mycheck_noerr(err)
#define myverify(assertion)   do { (void) (assertion); } while (0)
#define myverify_noerr(assertion)   myverify(assertion)
#define CallCopyObjectFilterProc(userRoutine, containerChanged, currentLevel, currentOSErr, catalogInfo, ref, spec, name, yourDataPtr)   (*(userRoutine))((containerChanged), (currentLevel), (currentOSErr), (catalogInfo), (ref), (spec), (name), (yourDataPtr))

Typedefs

typedef ItemCount currentLevel
typedef ItemCount OSErr currentOSErr
typedef ItemCount OSErr const
FSCatalogInfo * 
catalogInfo
typedef ItemCount OSErr const
FSCatalogInfo const FSRef
ref
typedef ItemCount OSErr const
FSCatalogInfo const FSRef
const FSSpec
spec
typedef ItemCount OSErr const
FSCatalogInfo const FSRef
const FSSpec const
HFSUniStr255 * 
name
typedef ItemCount OSErr const
FSCatalogInfo const FSRef
const FSSpec const
HFSUniStr255 void
yourDataPtr

Functions

typedef CALLBACK_API (Boolean, CopyObjectFilterProcPtr)(Boolean containerChanged
OSErr FSCopyObject (const FSRef *source, const FSRef *destDir, UniCharCount nameLength, const UniChar *copyName, ItemCount maxLevels, FSCatalogInfoBitmap whichInfo, Boolean wantFSSpec, Boolean wantName, CopyObjectFilterProcPtr filterProcPtr, void *yourDataPtr, FSRef *newObject)
OSErr FSDeleteObjects (const FSRef *source)

Define Documentation

#define CallCopyObjectFilterProc (   userRoutine,
  containerChanged,
  currentLevel,
  currentOSErr,
  catalogInfo,
  ref,
  spec,
  name,
  yourDataPtr 
)    (*(userRoutine))((containerChanged), (currentLevel), (currentOSErr), (catalogInfo), (ref), (spec), (name), (yourDataPtr))

Definition at line 152 of file FSCopyObject.h.

Definition at line 54 of file FSCopyObject.h.

#define mycheck (   assertion)

Definition at line 82 of file FSCopyObject.h.

Definition at line 83 of file FSCopyObject.h.

#define myverify (   assertion)    do { (void) (assertion); } while (0)

Definition at line 84 of file FSCopyObject.h.

#define myverify_noerr (   assertion)    myverify(assertion)

Definition at line 85 of file FSCopyObject.h.

#define QuoteExceptionString (   x)    #x

Definition at line 56 of file FSCopyObject.h.


Typedef Documentation

typedef ItemCount OSErr const FSCatalogInfo* catalogInfo

Definition at line 139 of file FSCopyObject.h.

typedef ItemCount currentLevel

Definition at line 139 of file FSCopyObject.h.

typedef ItemCount OSErr currentOSErr

Definition at line 139 of file FSCopyObject.h.

typedef ItemCount OSErr const FSCatalogInfo const FSRef const FSSpec const HFSUniStr255* name

Definition at line 139 of file FSCopyObject.h.

LDAPMessage * ref

Definition at line 139 of file FSCopyObject.h.

typedef ItemCount OSErr const FSCatalogInfo const FSRef const FSSpec* spec

Definition at line 139 of file FSCopyObject.h.

typedef ItemCount OSErr const FSCatalogInfo const FSRef const FSSpec const HFSUniStr255 void* yourDataPtr

Definition at line 139 of file FSCopyObject.h.


Function Documentation

typedef CALLBACK_API ( Boolean  ,
CopyObjectFilterProcPtr   
)
OSErr FSCopyObject ( const FSRef source,
const FSRef destDir,
UniCharCount  nameLength,
const UniChar *  copyName,
ItemCount  maxLevels,
FSCatalogInfoBitmap  whichInfo,
Boolean  wantFSSpec,
Boolean  wantName,
CopyObjectFilterProcPtr  filterProcPtr,
void yourDataPtr,
FSRef newObject 
)

Definition at line 294 of file FSCopyObject.c.

{
       CopyParams    copyParams;
       FilterParams  filterParams;
       HFSUniStr255  destName;
       HFSUniStr255  *destNamePtr;
       Boolean                     isDirectory;
       OSErr                osErr = ( source != NULL && destDir != NULL ) ? noErr : paramErr;
  
       if (copyName)
       {
              if (nameLength <= 255)
              {
                     BlockMoveData(copyName, destName.unicode, nameLength * sizeof(UniChar));
                     destName.length = nameLength;
                     destNamePtr = &destName;
              }
              else
                     osErr = paramErr;
       }
       else
              destNamePtr = NULL;
  
              // we want the settable info no matter what the user asked for
       filterParams.whichInfo             = whichInfo | kFSCatInfoSettableInfo;
       filterParams.filterProcPtr  = filterProcPtr;
       filterParams.fileSpecPtr    = ( wantFSSpec ) ? &filterParams.fileSpec : NULL;
       filterParams.fileNamePtr    = ( wantName   ) ? &filterParams.fileName : NULL;
       filterParams.yourDataPtr    = yourDataPtr;

              // Calculate the optimal buffer size to copy the forks over
              // and create the buffer
       if( osErr == noErr )
              osErr = CalculateBufferSize( source, destDir, &copyParams.copyBufferSize);

       if( osErr == noErr )
       {
              copyParams.copyBuffer = NewPtr( copyParams.copyBufferSize );
              if( copyParams.copyBuffer == NULL )
                     osErr = memFullErr;
       }

       if( osErr == noErr )
              osErr = GetMagicBusyCreationDate( &copyParams.magicBusyCreateDate ); 

       if( osErr == noErr ) // figure out if source is a file or folder
       {                                         //                     if it is on a local volume, 
                                                 //                     if destination is a drop box 
              GetVolParmsInfoBuffer       volParms;
              FSCatalogInfo               tmpCatInfo;
              FSVolumeRefNum                     destVRefNum;

                     // to figure out if the souce is a folder or directory
              osErr = FSGetCatalogInfo(source, kFSCatInfoNodeFlags, &tmpCatInfo, NULL, NULL, NULL);
              if( osErr == noErr )
              {
                     isDirectory = ((tmpCatInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0);
                            // are we copying to a drop folder?
                     osErr = IsDropBox( destDir, &copyParams.copyingToDropFolder );
              }
              if( osErr == noErr )        
                     osErr = FSGetVRefNum(destDir, &destVRefNum);
              if( osErr == noErr )
                     osErr = FSGetVolParms( destVRefNum, sizeof(volParms), &volParms, NULL );
              if( osErr == noErr ) // volParms.vMServerAdr is non-zero for remote volumes
                     copyParams.copyingToLocalVolume = (volParms.vMServerAdr == 0);
       }
       
              // now copy the file/folder...
       if( osErr == noErr )
       {             // is it a folder?
              if ( isDirectory )
              {             // yes
                     osErr = CheckForDestInsideSource(source, destDir);
                     if( osErr == noErr )
                            osErr = FSCopyFolder( source, destDir, destNamePtr, &copyParams, &filterParams, maxLevels, newObject );
              }
              else   // no
                     osErr = FSCopyFile(source, destDir, destNamePtr, &copyParams, &filterParams, newObject);
       }
       
       // Clean up for space and safety...  Who me?
       if( copyParams.copyBuffer != NULL )
              DisposePtr((char*)copyParams.copyBuffer);
       
       mycheck_noerr( osErr );     // put up debug assert in debug builds
       
       return osErr;
}                            

Here is the call graph for this function:

OSErr FSDeleteObjects ( const FSRef source)

Definition at line 1384 of file FSCopyObject.c.

{
       FSCatalogInfo catalogInfo;
       OSErr                osErr = ( source != NULL ) ? noErr : paramErr;
       
              // get nodeFlags for container
       if( osErr == noErr )
              osErr = FSGetCatalogInfo(source, kFSCatInfoNodeFlags, &catalogInfo, NULL, NULL,NULL);
       if( osErr == noErr && (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0 )
       {             // its a directory, so delete its contents before we delete it
              osErr = FSDeleteFolder(source);
       }
       if( osErr == noErr && (catalogInfo.nodeFlags & kFSNodeLockedMask) != 0 )     // is object locked?
       {             // then attempt to unlock the object (ignore osErr since FSDeleteObject will set it correctly)
              catalogInfo.nodeFlags &= ~kFSNodeLockedMask;
              (void) FSSetCatalogInfo(source, kFSCatInfoNodeFlags, &catalogInfo);
       }             
       if( osErr == noErr ) // delete the object (if it was a directory it is now empty, so we can delete it)
              osErr = FSDeleteObject(source);

       mycheck_noerr( osErr );
       
       return ( osErr );
}

Here is the call graph for this function:

Here is the caller graph for this function: