Backport path.resolve code from 0.10.x re: https://github.com/balderdashy/sails/pull/1500 and https://github.com/balderdashy/sails/issues/1499