'name' is used only for 'dirname'; pass in 'dirname' explicitly instead