`path.dirname()` is better than accessing array by index without checking if there's anything there.