function _buildDirsFirstComparator(contents) {
        function _dirsFirstCompare(a, b) {
            var aIsFile = FileTreeViewModel.isFile(contents.get(a)),
                bIsFile = FileTreeViewModel.isFile(contents.get(b));

            if (!aIsFile && bIsFile) {
                return -1;
            } else if (aIsFile && !bIsFile) {
                return 1;
            } else {
                return FileUtils.compareFilenames(a, b);
            }
        }
        return _dirsFirstCompare;
    }
@private

Creates a comparison function for sorting a directory's contents with directories
appearing before files.

We're sorting the keys of the directory (the names) based partly on the values,
so we use a closure to capture the map itself so that we can look up the
values as needed.

@param {Immutable.Map} contents The directory's contents
@return {function(string,string)} Comparator that sorts directories first.