only do path.resolve when `typeof root == 'string'`