2 * Copyright 2008, Stephan Aßmus <superstippi@gmx.de>.
3 * Copyright 1998-2007, Matthijs Hollemans.
5 * Distributed under the terms of the MIT License.
9 #include "FileIterator.h"
18 FileIterator::FileIterator()
23 FileIterator::~FileIterator()
29 FileIterator::_ExamineFile(BEntry
& entry
, char* buffer
, bool textFilesOnly
)
32 if (entry
.GetPath(&path
) != B_OK
)
35 strcpy(buffer
, path
.Path());
42 BNodeInfo
nodeInfo(&node
);
43 char mimeTypeString
[B_MIME_TYPE_LENGTH
];
45 if (nodeInfo
.GetType(mimeTypeString
) != B_OK
) {
46 // try to get a MIME type before failing
47 if (BMimeType::GuessMimeType(path
.Path(), &mimeType
) != B_OK
)
50 nodeInfo
.SetType(mimeType
.Type());
52 mimeType
.SetTo(mimeTypeString
);
55 if (mimeType
.GetSupertype(&superType
) == B_OK
) {
56 if (strcmp("text", superType
.Type()) == 0
57 || strcmp("message", superType
.Type()) == 0) {
61 // Make an exception for XHTML files
62 if (strcmp("application/xhtml+xml", mimeTypeString
) == 0)