[haiku-development] Re: How to Identify a file?

  • From: "Jérôme Duval" <korli@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 18 Oct 2007 11:40:31 +0200

2007/10/18, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> Stephan Assmus <superstippi@xxxxxx> wrote:
> >       BFile file(&ref, B_READ_ONLY);
>
> A BNode node(&ref) is enough here, though.
>
> >       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);
> >               }
> >       }
>
> And since these are all no pointer, you would of course use "." not "->
> " to reference their methods :-)
>

And make sure to traverse the entry ref to support dropped links.

Bye,
Jérôme

Other related posts: