Quote path args which may contain spaces, and fix unidiomatic if

Untested, but I think this should be fine. :-)