builder: move the XDG path handling in an own file

Just code motion and renaming, no actual behaviour changes.