Drying up a bit of path handling code.