Detects whether it the given path is a directory