On 2005-01-09 at 18:13:26 [+0100], Axel Dörfler wrote: > Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx> wrote: > > I wouldn't object to something like a > > BNodeInfo::GuessMimeType(BMimeType > > *), which would take the file name into account, if the data-based > > sniffing > > is inconclusive (just like the entry_ref version of > > BMimeType::GuessMimeType()). > > Shouldn't it go the other way around? Ie. test the name first, and then > look for the contents? Well, that's how BMimeType::GuessMimeType(const entry_ref*,...) works. This way misnamed files can still be recognized correctly. It would have trouble with your example of an OpenOffice document. But maybe those use a different magic ID? > BTW BNodeInfo::GuessMimeType(BMimeType *) should have a second > parameter like "filenameOnly = false" or "sniffData = true" - that way > it could directly be used by things like Tracker to get a rough guess > of the file type as fast as possible (it then would just show the > generic file type icon for those where this fails, and could do a > deeper test for the data asynchronously). > The advantage of this approach is that all file types where the suffix > is sufficient are determined immediately with no visual delay for the > user. Since this is only important for non-BFS volumes anyway, the > chance that the suffix is sufficient is a very good one, too. Yep, sounds good. > For mimetype enabled volumes, BNodeInfo::GuessMimeType() should > probably store the type, too - it doesn't make a lot of sense to lose > it again then. Maybe have a second boolean parameter to specify this (on read-only disks or FS that don't support attributes, the Tracker should indicate not to try saving the type). > Anyway, the most important thing to get right is BRoster::Launch() > anyway, since it's quite annoying for the user (while the missing icon > is just unfortunate). Our BRoster should already work correctly (at least, if update_mime_info() returns an error, if updating fails for any reason). If not, that should be very easily fixable. CU, Ingo