nsFileURL 		parentDir(uri); nsNativeFileSpec 	nativeDir(parentDir); for (nsDirectoryIterator i(nativeDir, PR_FALSE); i.Exists(); i++)
nsCOMPtr<nsIURI>	fileURI; if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(fileURI), parentURI))) return(rv); if (!fileURI)	return(NS_ERROR_UNEXPECTED);  nsCOMPtr<nsIChannel>	channel; if (NS_FAILED(rv = NS_OpenURI(getter_AddRefs(channel), fileURI, nsnull, nsnull))) return(rv); if (!channel)	return(NS_ERROR_UNEXPECTED);  nsCOMPtr<nsIFileChannel>	fileChannel = do_QueryInterface(channel); if (!fileChannel)	return(NS_ERROR_UNEXPECTED);  nsCOMPtr<nsIFile>	aDir; if (NS_FAILED(rv = fileChannel->GetFile(getter_AddRefs(aDir)))) return(rv);  nsCOMPtr<nsISimpleEnumerator>	dirContents; if (NS_FAILED(rv = aDir->GetDirectoryEntries(getter_AddRefs(dirContents)))) return(rv); if (!dirContents)	return(NS_ERROR_UNEXPECTED);  PRBool			hasMore; while(NS_SUCCEEDED(rv = dirContents->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE))
FileSystemDataSource::GetFolderList(nsIRDFResource *source, PRBool allowHidden, nsISimpleEnumerator** aResult){	nsresult	rv;	nsCOMPtr<nsISupportsArray> nameArray;	rv = NS_NewISupportsArray(getter_AddRefs(nameArray));	if (NS_FAILED(rv)) return rv;	const char		*uri;	rv = source->GetValueConst(&uri);	if (NS_FAILED(rv)) return(rv);	nsFileURL 		parentDir(uri);	nsNativeFileSpec 	nativeDir(parentDir);	for (nsDirectoryIterator i(nativeDir, PR_FALSE); i.Exists(); i++)	{		const nsNativeFileSpec	nativeSpec = (const nsNativeFileSpec &)i;		if (allowHidden == PR_FALSE)		{			if (!isVisible(nativeSpec))	continue;		}		nsFileURL		fileURL(nativeSpec);		const char		*childURL = fileURL.GetAsString();		if (childURL != nsnull)		{			nsCOMPtr<nsIRDFResource> file;			gRDFService->GetResource(childURL, getter_AddRefs(file));			nameArray->AppendElement(file);		}	}	nsISimpleEnumerator* result = new nsArrayEnumerator(nameArray);	if (! result)		return NS_ERROR_OUT_OF_MEMORY;	NS_ADDREF(result);	*aResult = result;	return NS_OK;}