Use dirname instead of parent

Because the corresponded method of basename is dirname.
catalog-generate: ensure output directory existence