Split up some file resolution logic so it could be leveraged for mocking.