Browse Source

Sort files in send queue.

Martin Edenhofer 11 years ago
parent
commit
81dbbdbfcb
1 changed files with 8 additions and 2 deletions
  1. 8 2
      lib/session.rb

+ 8 - 2
lib/session.rb

@@ -265,11 +265,17 @@ module Session
   def self.queue( client_id )
     path = @path + '/' + client_id.to_s + '/'
     data = []
-    Dir.foreach( path ) do |entry|
+    files = []
+    Dir.foreach( path ) {|entry|
+      next if entry == '.' || entry == '..'
+      files.push entry
+    }
+    files.sort.each {|entry|
+      filename = path + '/' + entry
       if /^send/.match( entry )
         data.push Session.queue_file( path, entry )
       end
-    end
+    }
     return data
   end