dir.c: refactor is_path_excluded()