mirobot / mirobot-ui

The web application that is used to control Mirobot (http://mirobot.io)
GNU General Public License v2.0
16 stars 14 forks source link

File list needs to be sorted to make sure zzz.html is at the end #21

Closed arjenlentz closed 9 years ago

bjpirt commented 9 years ago

Odd, the file list comes out sorted on my machine, but maybe it's a platform thing. If it fixed it for you though, I'm happy to merge

arjenlentz commented 9 years ago

Indeed, so it seems - as per the docs below (last paragraph, last sentence), and of course we mustn't depend on platform-specific behaviour.

http://docs.ruby-lang.org/en/2.1.0/Dir.html

glob( pattern, [flags] ) → matches glob( pattern, [flags] ) { |filename| block } → nil

Expands pattern, which is an Array of patterns or a pattern String, and returns the results as matches or as arguments given to the block.

Note that this pattern is not a regexp, it's closer to a shell glob. See File.fnmatch for the meaning of the flags parameter. Note that case sensitivity depends on your system (so File::FNM_CASEFOLD is ignored), as does the order in which the results are returned.