it's a micro-optimisation, but:

given that you don't check the return value of mkdir (and you don't need to), you could just do configDir.mkdir, and remove the exists() check. this will use the same number of syscalls in the case where it already exists (one: mkdir(2) which will fail with EEXIST, versus a stat()), but it'll only use a single syscall in the case where it doesn't (stat, mkdir), and the stat causes allocations