Fix atom.sh when running from directory with space

Deal with ATOM_PATH having a space by proper quoting, and not passing
the directory name to dirname.

Fixes atom/atom#4336
Use xargs -0 instead of sed, as this is easier to understand.
Fixed atom/atom#4337
Fixes atom/atom#4336
Merge pull request #4337 from pwagland/master

Fix atom.sh when running from directory with space