rem: BEntry ent; BString crud; BDirectory sub; char buf[255]; while (of->GetNextEntry(&ent) == B_OK) { if (ent.IsDirectory()) { sub.SetTo(&ent); ent.GetName(buf); crud = prepend; crud << buf << '/'; GetSubFolders(&sub,folders,crud.String()); crud = prepend; crud << buf; (*folders) += crud.String(); }
add: BEntry entry; while (of->GetNextEntry(&entry) == B_OK) { if (!entry.IsDirectory()) continue;  BDirectory subDirectory(&entry);  char buffer[B_FILE_NAME_LENGTH]; entry.GetName(buffer);  BString path = prepend; path << buffer << '/'; GetSubFolders(&subDirectory, folders, path.String()); path = prepend; path << buffer; *folders += path.String();
context: void GetSubFolders(BDirectory *of, BStringList *folders, const char *prepend) {	of->Rewind();	BEntry ent;	BString crud;	BDirectory sub;	char buf[255];	while (of->GetNextEntry(&ent) == B_OK) {		if (ent.IsDirectory()) {			sub.SetTo(&ent);			ent.GetName(buf);			crud = prepend;			crud << buf << '/';			GetSubFolders(&sub,folders,crud.String());			crud = prepend;			crud << buf;			(*folders) += crud.String();		}	}}