2007/10/18, Stephan Assmus <superstippi@xxxxxx>: > > [...] > > entry_ref ref; > for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK; > i++) { > BFile file(&ref, B_READ_ONLY); > BNodeInfo nodeInfo(&file); > char mimeString[B_MIME_TYPE_LENGTH]; > if (nodeInfo->GetType(mimeString) == B_OK) { > BMimeType fileType(mimeString); > BMimeType superType; > if (fileType->GetSupertype(&superType) == B_OK) { > if (superType == "audio" || superType == "video") > AppendToPlaylistRecursive(ref, playlist); > } > } > } > > It could also be a lot less nested by using the continue keyword: entry_ref ref; for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK; i++) { BFile file(&ref, B_READ_ONLY); BNodeInfo nodeInfo(&file); char mimeString[B_MIME_TYPE_LENGTH]; if (nodeInfo->GetType(mimeString) != B_OK) continue; BMimeType fileType(mimeString); BMimeType superType; if (fileType->GetSupertype( &superType) != B_OK) continue; if (superType == "audio" || superType == "video") AppendToPlaylistRecursive(ref, playlist); } -- Fredrik Holmqvist Chaordic: things that thrive on the edge of chaos with just enough order to give them pattern, but not so much to slow their adaptation and learning.