Remove empty strings from the split path to stop path.join resolving the cwd.
more concise code, commented special case and minor cleanup
0.2.1 fixes paths starting with /