appletpaths.c

Go to the documentation of this file.
00001 
00002 /*  $Id: appletpaths.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #include "appletpaths.h"
00008 #include "appletmemory.h"
00009 #include "appletstrings.h"
00010 
00011 
00012 
00013 static boolean directorytopath (long DirID, short vnum, bigstring path) {
00014     
00015     CInfoPBRec block;
00016     bigstring bsdirectory;
00017     OSErr errcode;
00018     
00019     setemptystring (path);
00020     
00021     clearbytes (&block, longsizeof (block));
00022     
00023     block.dirInfo.ioNamePtr = bsdirectory;
00024     
00025     block.dirInfo.ioDrParID = DirID;
00026     
00027     do {
00028         block.dirInfo.ioVRefNum = vnum;
00029         
00030         block.dirInfo.ioFDirIndex = -1;
00031         
00032         block.dirInfo.ioDrDirID = block.dirInfo.ioDrParID;
00033         
00034         errcode = PBGetCatInfo(&block,false);
00035         
00036         if (errcode != noErr)
00037             return (false);
00038         
00039         if (!pushchar (':', bsdirectory))
00040             return (false);
00041             
00042         if (!pushstring (path, bsdirectory))
00043             return (false);
00044         
00045         copystring (bsdirectory, path);
00046         } while (block.dirInfo.ioDrDirID != fsRtDirID);
00047     
00048     return (true);
00049     } /*directorytopath*/
00050 
00051 
00052 static boolean PathNameFromWD (long vnum, bigstring path) {
00053     
00054     WDPBRec block;
00055     
00056     clearbytes (&block, longsizeof (block));
00057     
00058     block.ioVRefNum = vnum;
00059     
00060     PBGetWDInfo (&block, false);
00061     
00062     return (directorytopath (block.ioWDDirID, block.ioWDVRefNum, path));
00063     } /*PathNameFromWD*/
00064     
00065     
00066 boolean filegetfolder (ptrfilespec pfs, bigstring folderpath) {
00067     
00068     return (directorytopath ((*pfs).parID, (*pfs).vRefNum, folderpath));
00069     } /*filegetfolder*/
00070 
00071 
00072 boolean filegetpath (ptrfilespec pfs, bigstring path) {
00073     
00074     if (!directorytopath ((*pfs).parID, (*pfs).vRefNum, path))
00075         return (false);
00076         
00077     pushstring ((*pfs).name, path);
00078     
00079     return (true);
00080     } /*filegetpath*/
00081     
00082     

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