{ nsresult rv = NS_OK; if (mNext == nsnull && mDir) { char* name = My_ReadDir(mDir, PR_SKIP_BOTH); if (name == nsnull) {  My_CloseDir(mDir); mDir = nsnull; *result = PR_FALSE; return NS_OK; }   nsCOMPtr<nsILocalFile> file; rv =  NS_NewLocalFile("dummy:path", PR_TRUE, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv;   FSSpec	tempSpec; tempSpec.vRefNum = mDir->ioVRefNum; tempSpec.parID = mDir->ioDirID; tempSpec.name[0] = 0; nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(file); if (localFileMac) { localFileMac->InitWithFSSpec(&tempSpec); }   rv = file->SetLeafName(name); if (NS_FAILED(rv)) return rv;  mNext = do_QueryInterface(file); } *result = mNext != nsnull; return NS_OK; }
{ nsresult rv = NS_OK; if (mNext == nsnull) { mItemName[0] = 0; mCatInfo.dirInfo.ioFDirIndex = mItemIndex; mCatInfo.dirInfo.ioDrDirID = mDirID;  OSErr err = ::PBGetCatInfoSync(&mCatInfo); if (err == fnfErr) {  *result = PR_FALSE; return  NS_OK; }   FSSpec  tempSpec; tempSpec.vRefNum = mCatInfo.hFileInfo.ioVRefNum; tempSpec.parID = mDirID; ::BlockMoveData(mItemName, tempSpec.name, mItemName[0] + 1);  rv = NS_NewLocalFileWithFSSpec(&tempSpec, PR_TRUE, getter_AddRefs(mNext)); if (NS_FAILED(rv)) return rv; } *result = mNext != nsnull; return NS_OK; }
		NS_IMETHOD HasMoreElements(PRBool *result) 		{			nsresult rv = NS_OK;			if (mNext == nsnull && mDir) 			{				char* name = My_ReadDir(mDir, PR_SKIP_BOTH);				if (name == nsnull) 				{					// end of dir entries					My_CloseDir(mDir);					mDir = nsnull;					*result = PR_FALSE;					return NS_OK;				}								// Make a new nsILocalFile for the new element				nsCOMPtr<nsILocalFile> file;				rv =  NS_NewLocalFile("dummy:path", PR_TRUE, getter_AddRefs(file));				if (NS_FAILED(rv)) 					return rv;								// Init with the FSSpec for the current dir				FSSpec	tempSpec;				tempSpec.vRefNum = mDir->ioVRefNum;				tempSpec.parID = mDir->ioDirID;				tempSpec.name[0] = 0;				nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(file);				if (localFileMac) {					localFileMac->InitWithFSSpec(&tempSpec);				}								// Now set the leaf name of the new nsILocalFile to the new element				rv = file->SetLeafName(name);				if (NS_FAILED(rv)) 					return rv;							mNext = do_QueryInterface(file);			}			*result = mNext != nsnull;			return NS_OK;		}