dir.c: unify is_excluded and is_path_excluded APIs