appletfiletempfolder.c

Go to the documentation of this file.
00001 
00002 /*  $Id: appletfiletempfolder.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #include <Script.h>
00008 #include <Folders.h>
00009 #include "applet.h"
00010 #include "appletfilesinternal.h"
00011 #include "appletfiletempfolder.h"
00012 
00013 
00014 boolean filegettempfolder (short sourcevnum, bigstring foldername, short *vnum, long *dirid) {
00015     
00016     FSSpec fs;
00017     CInfoPBRec pb;
00018     OSErr ec;
00019     
00020     ec = FindFolder (sourcevnum, kTemporaryFolderType, kCreateFolder, &fs.vRefNum, &fs.parID);
00021     
00022     if (ec != noErr)
00023         ec = FindFolder (kOnSystemDisk, kTemporaryFolderType, kCreateFolder, &fs.vRefNum, &fs.parID);
00024     
00025     if (fileerror (nil, ec)) 
00026         return (false);
00027     
00028     ec = FSMakeFSSpec (fs.vRefNum, fs.parID, foldername, &fs);
00029     
00030     if (ec == fnfErr)
00031         ec = FSpDirCreate (&fs, smSystemScript, dirid);
00032             
00033     if (fileerror (nil, ec)) 
00034         return (false);
00035     
00036     if (!getmacfileinfo (&fs, &pb))
00037         return (false);
00038     
00039     *vnum = pb.dirInfo.ioVRefNum;
00040     
00041     *dirid = pb.dirInfo.ioDrDirID;
00042     
00043     return (true);
00044     } /*filegettempfolder*/
00045 
00046 

Generated on Wed May 31 18:19:41 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6