fix viewPath' bug, improve code

use 'path.resolve' here is a easy way to use a path not quite relative with the root temporarily,
and i don't think this is a bug.