fix opendir() emulation to return ENOTDIR if the path is a file, so that 'ag foo file.txt' works
add a test for bug fixed in previous checkin