Extract change dir logic into s:set_makedir