Portably handle paths so they stand a chance of working on non-Unix-like platforms

Note that I haven't actually tested this on Win32 or platforms other
than Unix-likes.  I just rewrote the path handling to use File::Spec's
methods.