Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsLocalFileMac.cpp File Reference
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsXPIDLString.h"
#include "nsLocalFile.h"
#include "nsNativeCharsetUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsIComponentManager.h"
#include "nsIInternetConfigService.h"
#include "nsIMIMEInfo.h"
#include "prtypes.h"
#include "prerror.h"
#include "nsReadableUtils.h"
#include "nsITimelineService.h"
#include "pprio.h"
#include "prmem.h"
#include "plbase64.h"
#include "FullPath.h"
#include "FileCopy.h"
#include "MoreFilesExtras.h"
#include "DirectoryCopy.h"
#include <Script.h>
#include <Processes.h>
#include <StringCompare.h>
#include <Resources.h>
#include <AppleEvents.h>
#include <AEDataModel.h>
#include <AERegistry.h>
#include <Gestalt.h>
#include <Math64.h>
#include <Aliases.h>
#include <Folders.h>
#include "macDirectoryCopy.h"
#include <limits.h>
#include <FSp_fopen.h>

Go to the source code of this file.

Classes

class  nsPathParser
class  StFollowLinksState
class  nsDirEnumerator
class  StAEDesc

Defines

#define aeSelectionKeyword   'fsel'
#define kAEOpenSelection   'sope'
#define kAERevealSelection   'srev'
#define kFinderType   'FNDR'

Functions

static void ClearFSSpec (FSSpec &aSpec)
static nsresult MacErrorMapper (OSErr inErr)
static PRBool IsEqualFSSpec (const FSSpec &file1, const FSSpec &file2)
static OSErr GetParentFolderSpec (const FSSpec &fileSpec, FSSpec &parentDirSpec)
static OSErr VolHasDesktopDB (short vRefNum, Boolean *hasDesktop)
static OSErr GetLastModDateTime (const FSSpec *fSpec, unsigned long *lastModDateTime)
static OSErr FindAppOnVolume (OSType sig, short vRefNum, FSSpec *file)
static OSErr GetIndVolume (short index, short *vRefNum)
static void MyReadLocation (MachineLocation *loc)
static long GMTDelta (void)
static void MacintoshInitializeTime (void)
static nsresult ConvertMacTimeToMilliseconds (PRInt64 *aLastModifiedTime, PRUint32 timestamp)
static nsresult ConvertMillisecondsToMacTime (PRInt64 aTime, PRUint32 *aOutMacTime)
static void myPLstrcpy (Str255 dst, const char *src)
static void myPLstrncpy (Str255 dst, const char *src, int inMax)
const char * NS_TruncNodeName (const char *aNode, char *outBuf)
static OSErr HFSPlusGetRawPath (const FSSpec &inSpec, nsAString &outStr)
 HFSPlusGetRawPath returns the path for an FSSpec as a unicode string.
static OSErr ResolvePathAndSpec (const char *filePath, FSSpec *inSpec, PRBool createDirs, FSSpec *outSpec)
 NS_IMPL_THREADSAFE_ISUPPORTS3 (nsLocalFile, nsILocalFileMac, nsILocalFile, nsIFile) NS_METHOD nsLocalFile
nsresult NS_NewNativeLocalFile (const nsACString &path, PRBool followLinks, nsILocalFile **result)
nsresult NS_NewLocalFile (const nsAString &path, PRBool followLinks, nsILocalFile **result)
 Public Method to create an instance of a nsILocalFile.
nsresult NS_NewLocalFileWithFSSpec (const FSSpec *inSpec, PRBool followLinks, nsILocalFileMac **result)

Variables

const OSType kDefaultCreator = 'MOSS'
static unsigned long gJanuaryFirst1970Seconds = 0

Define Documentation

#define aeSelectionKeyword   'fsel'

Definition at line 2631 of file nsLocalFileMac.cpp.

#define kAEOpenSelection   'sope'

Definition at line 2632 of file nsLocalFileMac.cpp.

#define kAERevealSelection   'srev'

Definition at line 2633 of file nsLocalFileMac.cpp.

#define kFinderType   'FNDR'

Definition at line 2634 of file nsLocalFileMac.cpp.


Function Documentation

static void ClearFSSpec ( FSSpec aSpec) [inline, static]

Definition at line 170 of file nsLocalFileMac.cpp.

{
    aSpec.vRefNum = 0;
    aSpec.parID = 0;
    aSpec.name[0] = 0;
}
static nsresult ConvertMacTimeToMilliseconds ( PRInt64 aLastModifiedTime,
PRUint32  timestamp 
) [static]

Definition at line 485 of file nsLocalFileMac.cpp.

{
    if ( gJanuaryFirst1970Seconds == 0)
        MacintoshInitializeTime();
    timestamp -= gJanuaryFirst1970Seconds;
    PRTime usecPerSec, dateInMicroSeconds;
    LL_I2L(dateInMicroSeconds, timestamp);
    LL_I2L(usecPerSec, PR_MSEC_PER_SEC);
    LL_MUL(*aLastModifiedTime, usecPerSec, dateInMicroSeconds);
    return NS_OK;
}

Here is the call graph for this function:

static nsresult ConvertMillisecondsToMacTime ( PRInt64  aTime,
PRUint32 aOutMacTime 
) [static]

Definition at line 497 of file nsLocalFileMac.cpp.

{
    NS_ENSURE_ARG( aOutMacTime );
        
    PRTime usecPerSec, dateInSeconds;
    dateInSeconds = LL_ZERO;
    
    LL_I2L(usecPerSec, PR_MSEC_PER_SEC);
    LL_DIV(dateInSeconds, aTime, usecPerSec); // dateInSeconds = aTime/1,000
    LL_L2UI(*aOutMacTime, dateInSeconds);
    *aOutMacTime += 2082844800; // date + Mac epoch

    return NS_OK;
}
static OSErr FindAppOnVolume ( OSType  sig,
short  vRefNum,
FSSpec file 
) [static]

Definition at line 336 of file nsLocalFileMac.cpp.

{
    DTPBRec     pb;
    OSErr       err = noErr;
    short       ioDTRefNum, i;
    FInfo       fInfo;
    FSSpec      candidate;
    unsigned long lastModDateTime, maxLastModDateTime;

    memset(&pb, 0, sizeof(DTPBRec));
    pb.ioCompletion = nil;
    pb.ioVRefNum = vRefNum;
    pb.ioNamePtr = nil;
    err = PBDTGetPath(&pb);
    if (err != noErr) return err;
    ioDTRefNum = pb.ioDTRefNum;

    memset(&pb, 0, sizeof(DTPBRec));
    pb.ioCompletion = nil;
    pb.ioIndex = 0;
    pb.ioFileCreator = sig;
    pb.ioNamePtr = file->name;
    pb.ioDTRefNum = ioDTRefNum;
    err = PBDTGetAPPLSync(&pb);
    
    if (err == fnfErr || err == paramErr) return afpItemNotFound;
    if (err != noErr) return err;

    file->vRefNum = vRefNum;
    file->parID = pb.ioAPPLParID;
    
    err = FSpGetFInfo(file, &fInfo);
    if (err == noErr) return noErr;
    
    i = 1;
    maxLastModDateTime = 0;
    while (true)
    {
        memset(&pb, 0, sizeof(DTPBRec)); 
        pb.ioCompletion = nil;
        pb.ioIndex = i;
        pb.ioFileCreator = sig;
        pb.ioNamePtr = candidate.name;
        pb.ioDTRefNum = ioDTRefNum;
        err = PBDTGetAPPLSync(&pb);
        if (err != noErr) break;
        candidate.vRefNum = vRefNum;
        candidate.parID = pb.ioAPPLParID;
        err = GetLastModDateTime(file, &lastModDateTime);
        if (err == noErr) {
            if (lastModDateTime > maxLastModDateTime) {
                maxLastModDateTime = lastModDateTime;
                *file = candidate;
            }
        }
        i++;
    }
    
    return maxLastModDateTime > 0 ? noErr : afpItemNotFound;
}

Here is the call graph for this function:

static OSErr GetIndVolume ( short  index,
short *  vRefNum 
) [static]

Definition at line 409 of file nsLocalFileMac.cpp.

{
    HParamBlockRec pb;
    Str63 volumeName;
    OSErr err = noErr;
    
    pb.volumeParam.ioCompletion = nil;
    pb.volumeParam.ioNamePtr = volumeName;
    pb.volumeParam.ioVolIndex = index;
    
    err = PBHGetVInfoSync(&pb);
    
    *vRefNum = pb.volumeParam.ioVRefNum;
    return err;
}

Here is the caller graph for this function:

static OSErr GetLastModDateTime ( const FSSpec fSpec,
unsigned long lastModDateTime 
) [static]

Definition at line 307 of file nsLocalFileMac.cpp.

{
    CInfoPBRec  pBlock;
    OSErr       err = noErr;
    
    pBlock.hFileInfo.ioNamePtr = (StringPtr)fSpec->name;
    pBlock.hFileInfo.ioVRefNum = fSpec->vRefNum;
    pBlock.hFileInfo.ioFDirIndex = 0;
    pBlock.hFileInfo.ioDirID = fSpec->parID;
    err = PBGetCatInfoSync(&pBlock);
    if (err != noErr) return err;
    *lastModDateTime = pBlock.hFileInfo.ioFlMdDat;
    return noErr;
}

Here is the caller graph for this function:

static OSErr GetParentFolderSpec ( const FSSpec fileSpec,
FSSpec parentDirSpec 
) [static]

Definition at line 247 of file nsLocalFileMac.cpp.

{
    CInfoPBRec  pBlock = {0};
    OSErr       err = noErr;
    
    parentDirSpec.name[0] = 0;
    
    pBlock.dirInfo.ioVRefNum = fileSpec.vRefNum;
    pBlock.dirInfo.ioDrDirID = fileSpec.parID;
    pBlock.dirInfo.ioNamePtr = (StringPtr)parentDirSpec.name;
    pBlock.dirInfo.ioFDirIndex = -1;        //get info on parID
    err = PBGetCatInfoSync(&pBlock);
    if (err != noErr) return err;
    
    parentDirSpec.vRefNum = fileSpec.vRefNum;
    parentDirSpec.parID = pBlock.dirInfo.ioDrParID;
    
    return err;
}
static long GMTDelta ( void  ) [static]

Definition at line 454 of file nsLocalFileMac.cpp.

{
    MachineLocation loc;
    long gmtDelta;

    MyReadLocation(&loc);
    gmtDelta = loc.u.gmtDelta & 0x00ffffff;
    if (gmtDelta & 0x00800000) {    /* test sign extend bit */
        gmtDelta |= 0xff000000;
    }
    return gmtDelta;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static OSErr HFSPlusGetRawPath ( const FSSpec inSpec,
nsAString &  outStr 
) [static]

HFSPlusGetRawPath returns the path for an FSSpec as a unicode string.

The reason for this routine instead of just calling FSRefMakePath is (1) inSpec does not have to exist (2) FSRefMakePath uses '/' as the separator under OSX and ':' under OS9

Definition at line 607 of file nsLocalFileMac.cpp.

{
    OSErr err;
    nsAutoString ucPathString;
    
    outStr.Truncate(0);
    
    FSRef nodeRef;
    FSCatalogInfo catalogInfo;
    catalogInfo.parentDirID = 0;
    err = ::FSpMakeFSRef(&inSpec, &nodeRef);
    
    if (err == fnfErr) {
        FSSpec parentDirSpec;               
        err = GetParentFolderSpec(inSpec, parentDirSpec);
        if (err == noErr) {
            const char *startPtr = (const char*)&inSpec.name[1];
            NS_CopyNativeToUnicode(Substring(startPtr, startPtr + PRUint32(inSpec.name[0])), outStr);
            err = ::FSpMakeFSRef(&parentDirSpec, &nodeRef);
        }
    }

    while (err == noErr && catalogInfo.parentDirID != fsRtParID) {
        HFSUniStr255 nodeName;
        FSRef parentRef;
        err = ::FSGetCatalogInfo(&nodeRef,
                                 kFSCatInfoNodeFlags + kFSCatInfoParentDirID,
                                 &catalogInfo,
                                 &nodeName,
                                 nsnull,
                                 &parentRef);
        if (err == noErr)
        {
            if (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)
                nodeName.unicode[nodeName.length++] = PRUnichar(':');
            const PRUnichar* nodeNameUni = (const PRUnichar*) nodeName.unicode;
            outStr.Insert(Substring(nodeNameUni, nodeNameUni + nodeName.length), 0);
            nodeRef = parentRef;
        }
    }
    return err;
}
static PRBool IsEqualFSSpec ( const FSSpec file1,
const FSSpec file2 
) [static]

Definition at line 230 of file nsLocalFileMac.cpp.

{
    return
        file1.vRefNum == file2.vRefNum &&
        file1.parID == file2.parID &&
        EqualString(file1.name, file2.name, false, true);
}
static nsresult MacErrorMapper ( OSErr  inErr) [static]

Definition at line 179 of file nsLocalFileMac.cpp.

{
    nsresult outErr;
    
    switch (inErr)
    {
        case noErr:
            outErr = NS_OK;
            break;

        case fnfErr:
            outErr = NS_ERROR_FILE_NOT_FOUND;
            break;

        case dupFNErr:
            outErr = NS_ERROR_FILE_ALREADY_EXISTS;
            break;
        
        case dskFulErr:
            outErr = NS_ERROR_FILE_DISK_FULL;
            break;
        
        case fLckdErr:
            outErr = NS_ERROR_FILE_IS_LOCKED;
            break;
        
        // Can't find good map for some
        case bdNamErr:
            outErr = NS_ERROR_FAILURE;
            break;

        default:    
            outErr = NS_ERROR_FAILURE;
            break;
    }
    return outErr;
}
static void MacintoshInitializeTime ( void  ) [static]

Definition at line 467 of file nsLocalFileMac.cpp.

{
    /*
     * The NSPR epoch is midnight, Jan. 1, 1970 GMT.
     *
     * At midnight Jan. 1, 1970 GMT, the local time was
     *     midnight Jan. 1, 1970 + GMTDelta().
     *
     * Midnight Jan. 1, 1970 is 86400 * (365 * (1970 - 1904) + 17)
     *     = 2082844800 seconds since the Mac epoch.
     * (There were 17 leap years from 1904 to 1970.)
     *
     * So the NSPR epoch is 2082844800 + GMTDelta() seconds since
     * the Mac epoch.  Whew! :-)
     */
    gJanuaryFirst1970Seconds = 2082844800 + GMTDelta();
}

Here is the call graph for this function:

static void myPLstrcpy ( Str255  dst,
const char *  src 
) [static]

Definition at line 512 of file nsLocalFileMac.cpp.

{
    int srcLength = strlen(src);
    NS_ASSERTION(srcLength <= 255, "Oops, Str255 can't hold >255 chars");
    if (srcLength > 255)
        srcLength = 255;
    dst[0] = srcLength;
    memcpy(&dst[1], src, srcLength);
}
static void myPLstrncpy ( Str255  dst,
const char *  src,
int  inMax 
) [static]

Definition at line 522 of file nsLocalFileMac.cpp.

{
    int srcLength = strlen(src);
    if (srcLength > inMax)
        srcLength = inMax;
    dst[0] = srcLength;
    memcpy(&dst[1], src, srcLength);
}
static void MyReadLocation ( MachineLocation *  loc) [static]

Definition at line 442 of file nsLocalFileMac.cpp.

{
    static MachineLocation storedLoc;
    static Boolean didReadLocation = false;
    
    if (!didReadLocation) {
        ReadLocation(&storedLoc);
        didReadLocation = true;
    }
    *loc = storedLoc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 986 of file nsLocalFileMac.cpp.

{
    NS_ENSURE_ARG_POINTER(aInstancePtr);
    NS_ENSURE_NO_AGGREGATION(outer);

    nsLocalFile* inst = new nsLocalFile();
    if (inst == NULL)
        return NS_ERROR_OUT_OF_MEMORY;
    
    nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
    if (NS_FAILED(rv))
    {
        delete inst;
        return rv;
    }
    return NS_OK;
}
nsresult NS_NewLocalFile ( const nsAString &  path,
PRBool  followLinks,
nsILocalFile **  result 
)

Public Method to create an instance of a nsILocalFile.

This function may be called prior to NS_InitXPCOM.

FROZEN

Parameters:
pathA string which specifies a full file path to a location. Relative paths will be treated as an error (NS_ERROR_FILE_UNRECOGNIZED_PATH). |NS_NewNativeLocalFile|'s path must be in the filesystem charset.
followLinksThis attribute will determine if the nsLocalFile will auto resolve symbolic links. By default, this value will be false on all non unix systems. On unix, this attribute is effectively a noop.
resultInterface pointer to a new instance of an nsILocalFile
Returns:
NS_OK for success; other error codes indicate a failure.

Definition at line 3518 of file nsLocalFileMac.cpp.

{
    nsCAutoString fsCharSetStr;   
    nsresult rv = NS_CopyUnicodeToNative(path, fsCharSetStr);
    if (NS_FAILED(rv))
        return rv;
    return NS_NewNativeLocalFile(fsCharSetStr, followLinks, result);
}
nsresult NS_NewLocalFileWithFSSpec ( const FSSpec inSpec,
PRBool  followLinks,
nsILocalFileMac **  result 
)

Definition at line 3528 of file nsLocalFileMac.cpp.

{
    nsLocalFile* file = new nsLocalFile();
    if (file == nsnull)
        return NS_ERROR_OUT_OF_MEMORY;
    NS_ADDREF(file);

    file->SetFollowLinks(followLinks);

    nsresult rv = file->InitWithFSSpec(inSpec);
    if (NS_FAILED(rv)) {
        NS_RELEASE(file);
        return rv;
    }
    *result = file;
    return NS_OK;
}
nsresult NS_NewNativeLocalFile ( const nsACString &  path,
PRBool  followLinks,
nsILocalFile **  result 
)

Definition at line 3497 of file nsLocalFileMac.cpp.

{
    nsLocalFile* file = new nsLocalFile();
    if (file == nsnull)
        return NS_ERROR_OUT_OF_MEMORY;
    NS_ADDREF(file);

    file->SetFollowLinks(followLinks);

    if (!path.IsEmpty()) {
        nsresult rv = file->InitWithNativePath(path);
        if (NS_FAILED(rv)) {
            NS_RELEASE(file);
            return rv;
        }
    }
    *result = file;
    return NS_OK;
}
const char* NS_TruncNodeName ( const char *  aNode,
char *  outBuf 
)

Definition at line 544 of file nsLocalFileMac.cpp.

{
    PRUint32 nodeLen;
    if ((nodeLen = strlen(aNode)) > 31)
    {
        static PRBool sInitialized = PR_FALSE;
        static CharByteTable sTable;
        // Init to "..." in case we fail to get the ellipsis token
        static char sEllipsisTokenStr[4] = { '.', '.', '.', 0 };
        static PRUint8 sEllipsisTokenLen = 3;
                
        if (!sInitialized)
        {
            // Entries in the table are:
            // 0 == 1 byte char
            // 1 == 2 byte char
            FillParseTable(sTable, smSystemScript);
            
            Handle itl4ResHandle = nsnull;
            long offset, len;
            ::GetIntlResourceTable(smSystemScript, smUnTokenTable, &itl4ResHandle, &offset, &len);
            if (itl4ResHandle)
            {
                UntokenTable *untokenTableRec = (UntokenTable *)(*itl4ResHandle + offset);
                if (untokenTableRec->lastToken >= tokenEllipsis)
                {
                    offset += untokenTableRec->index[tokenEllipsis];
                    char *tokenStr = (*itl4ResHandle + offset);
                    sEllipsisTokenLen = tokenStr[0];
                    memcpy(sEllipsisTokenStr, &tokenStr[1], sEllipsisTokenLen);
                }
                ::ReleaseResource(itl4ResHandle);
            }
            sInitialized = PR_TRUE;
        }

        PRInt32 halfLen = (31 - sEllipsisTokenLen) / 2;
        PRInt32 charSize = 0, srcPos, destPos;
        for (srcPos = 0; srcPos + charSize <= halfLen; srcPos += charSize)
            charSize = sTable[aNode[srcPos]] ? 2 : 1;
                    
        memcpy(outBuf, aNode, srcPos);
        memcpy(outBuf + srcPos, sEllipsisTokenStr, sEllipsisTokenLen);
        destPos = srcPos + sEllipsisTokenLen;
        
        for (; srcPos < nodeLen - halfLen; srcPos += charSize)
            charSize = sTable[aNode[srcPos]] ? 2 : 1;
            
        memcpy(outBuf + destPos, aNode + srcPos, nodeLen - srcPos);
        destPos += (nodeLen - srcPos);
        outBuf[destPos] = '\0';
        return outBuf;
    }
    return aNode;
}

Here is the caller graph for this function:

static OSErr ResolvePathAndSpec ( const char *  filePath,
FSSpec inSpec,
PRBool  createDirs,
FSSpec outSpec 
) [static]

Definition at line 655 of file nsLocalFileMac.cpp.

{
    OSErr   err = noErr;
    size_t  inLength = strlen(filePath);
    Boolean isRelative = (filePath && inSpec);
    FSSpec  tempSpec;
    Str255  ppath;
    Boolean isDirectory;
    
    if (isRelative && inSpec)
    {
        outSpec->vRefNum = inSpec->vRefNum;
        outSpec->parID = inSpec->parID;
        
        if (inSpec->name[0] != 0)
        {
            long theDirID;
            
            err = FSpGetDirectoryID(inSpec, &theDirID, &isDirectory);
        
            if (err == noErr  &&  isDirectory)
                outSpec->parID = theDirID;
            else if (err == fnfErr && createDirs)
            {
                err = FSpDirCreate(inSpec, smCurrentScript, &theDirID);
                if (err == noErr)
                    outSpec->parID = theDirID;
                else if (err == fnfErr)
                    err = dirNFErr; 
            }
        }
    }
    else
    {
        outSpec->vRefNum = 0;
        outSpec->parID = 0;
    }
    
    if (err)
        return err;
    
    // Try making an FSSpec from the path
    if (inLength < 255)
    {
        // Use tempSpec as dest because if FSMakeFSSpec returns dirNFErr, it
        // will reset the dest spec and we'll lose what we determined above.
        
        myPLstrcpy(ppath, filePath);
        err = ::FSMakeFSSpec(outSpec->vRefNum, outSpec->parID, ppath, &tempSpec);
        if (err == noErr || err == fnfErr)
            *outSpec = tempSpec;
    }
    else if (!isRelative)
    {
        err = ::FSpLocationFromFullPath(inLength, filePath, outSpec);
    }
    else
    {   // If the path is relative and >255 characters we need to manually walk the
        // path appending each node to the initial FSSpec so to reach that code we
        // set the err to bdNamErr and fall into the code below
        err = bdNamErr;
    }
    
    // If we successfully created a spec then leave
    if (err == noErr)
        return err;
    
    // We get here when the directory hierarchy needs to be created or we're resolving
    // a relative path >255 characters long
    if (err == dirNFErr || err == bdNamErr)
    {
        const char* path = filePath;
        
        if (!isRelative)    // If path is relative, we still need vRefNum & parID.
        {
            outSpec->vRefNum = 0;
            outSpec->parID = 0;
        }

        do
        {
            // Locate the colon that terminates the node.
            // But if we've a partial path (starting with a colon), find the second one.
            const char* nextColon = strchr(path + (*path == ':'), ':');
            // Well, if there are no more colons, point to the end of the string.
            if (!nextColon)
                nextColon = path + strlen(path);

            // Make a pascal string out of this node.  Include initial
            // and final colon, if any!
            myPLstrncpy(ppath, path, nextColon - path + 1);
            
            // Use this string as a relative path using the directory created
            // on the previous round (or directory 0,0 on the first round).
            err = ::FSMakeFSSpec(outSpec->vRefNum, outSpec->parID, ppath, outSpec);

            // If this was the leaf node, then we are done.
            if (!*nextColon)
                break;

            // Since there's more to go, we have to get the directory ID, which becomes
            // the parID for the next round.
            if (err == noErr)
            {
                // The directory (or perhaps a file) exists. Find its dirID.
                long dirID;
                err = ::FSpGetDirectoryID(outSpec, &dirID, &isDirectory);
                if (!isDirectory)
                    err = dupFNErr; // oops! a file exists with that name.
                if (err != noErr)
                    break;          // bail if we've got an error
                outSpec->parID = dirID;
            }
            else if ((err == fnfErr) && createDirs)
            {
                // If we got "file not found" and we're allowed to create directories 
                // then we need to create one
                err = ::FSpDirCreate(outSpec, smCurrentScript, &outSpec->parID);
                // For some reason, this usually returns fnfErr, even though it works.
                if (err == fnfErr)
                    err = noErr;
            }
            if (err != noErr)
                break;
            path = nextColon; // next round
        } while (true);
    }
    
    return err;
}
static OSErr VolHasDesktopDB ( short  vRefNum,
Boolean hasDesktop 
) [static]

Definition at line 279 of file nsLocalFileMac.cpp.

{
    HParamBlockRec      pb;
    GetVolParmsInfoBuffer   info;
    OSErr               err = noErr;
    
    pb.ioParam.ioCompletion = nil;
    pb.ioParam.ioNamePtr = nil;
    pb.ioParam.ioVRefNum = vRefNum;
    pb.ioParam.ioBuffer = (Ptr)&info;
    pb.ioParam.ioReqCount = sizeof(info);
    err = PBHGetVolParmsSync(&pb);
    *hasDesktop = err == noErr && (info.vMAttrib & (1L << bHasDesktopMgr)) != 0;
    return err;
}

Variable Documentation

unsigned long gJanuaryFirst1970Seconds = 0 [static]

Definition at line 427 of file nsLocalFileMac.cpp.

Definition at line 106 of file nsLocalFileMac.cpp.