Fixing atomics selection issue, to be CMR'd after it passes the nightly tests
ignore generators: sort the dirlist for repeatable output

Sort the output from reading directory contents so that the generated
.gitignore and .hgignore files will be much more consistent (and
friendly to change from subsequent runs, especially when they are
committed to SVN/git/hg repos).