Factor out source directory processing into Source class