(backport from cairocanvas branch) do not crash when considering a directory called midi (with any case) as an apparent MIDI file