Use the `Pathname.mkpath` function.