I investigated the problem further.

file_isdir() was made to use file_simplify_name() because of some bug in mingw [a7822bcc001e9]. Nevertheless, file_isdir() is called sometimes with a canonical filename, sometimes with a filename directly from program arguments.

The function file_simplify_name() works well only for canonical names, because it is meant to remove the ".." in absolute paths. So when file_isdir() is called without a canonical name with the sequence '../..' in it, it works bad.

As I don't know the mingw bug, I imagine that the file_simplify_name() call has to be there. So, I propose what comes to mind:
  *  Make file_simplify_name() work well when it's given a non-canonical name
  *  Make file_isdir() not call file_simplify_name() if the name is not canonical.

Any preference? As drh did the change [a7822bcc001e9], he may know the best option.