Improve handling of files and directories that contain spaces.

Limit the split-string regex to \r and \n; by default it includes
all whitespace characters as delimiters.