clean: simplify dir/not-dir logic