Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting parent of nonexistent file



If spec refers to a file that does NOT exist, but the parent directory (spec->parID) DOES exist, should this work?

OSErr FSpGetParent(FSSpec* spec)
{
    CInfoPBRec        pb;
    DirInfo*          dirRec = (DirInfo*)&pb;
    OSErr             err;
    Str255            s;

    PStrCopy(spec->name, s);
    dirRec->ioCompletion = nil;
    dirRec->ioNamePtr = s;
    dirRec->ioVRefNum = spec->vRefNum;
    dirRec->ioFDirIndex = -1;
    dirRec->ioDrDirID = spec->parID;
    err = PBGetCatInfoSync(&pb);

if(err == noErr)
err = FSMakeFSSpec(dirRec->ioVRefNum, dirRec->ioDrParID, s, spec);


    return err;
}

Should err returned from PBGetcatInfoSync be noErr or fnfErr, and should ioDrParID contain the parent directory upon completion?

I have a customer who is getting random problems when saving documents. We create a temp file in kTemporaryFolderType. Calling our FSpGetParent routine on a nonexistent file seems to work most of the time, but sometimes returns fnfErr. At this point I don't know which call in FSpGetParent is returning the fnfErr, so I'm adding more logging to a build for the customer.

They say the volume where these files reside are on an external FireWire drive connected to their OSX server. Is it possible that the TemporaryItems folder is being deleted between the time we call FindFolder and the call to FSpGetParent (which should be only microseconds apart from each other)?

_________________________________________________________
Steve Mills                              Me: 952-401-6255
Senior Software Architect                         MultiAd
email@hidden                       www.multi-ad.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.