aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/fs/fs.cpp16
-rw-r--r--backends/fs/fs.h1
-rw-r--r--gui/browser.cpp1
3 files changed, 17 insertions, 1 deletions
diff --git a/backends/fs/fs.cpp b/backends/fs/fs.cpp
index 983263b37d..d1e514621c 100644
--- a/backends/fs/fs.cpp
+++ b/backends/fs/fs.cpp
@@ -20,7 +20,21 @@
#include "stdafx.h"
-#include "fs.h"
+#include "backends/fs/fs.h"
+#include "common/util.h"
+
+void FSList::sort() {
+ // Simple selection sort
+ for (int i = 0; i < _size-1; i++) {
+ int min = i;
+ for (int j = i+1; j < _size; j++)
+ if (_data[j] < _data[min])
+ min = j;
+ if (min != i)
+ SWAP(_data[min], _data[i]);
+ }
+}
+
FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) {
FilesystemNode wrapper;
diff --git a/backends/fs/fs.h b/backends/fs/fs.h
index 493e7d0c37..5fe5b99996 100644
--- a/backends/fs/fs.h
+++ b/backends/fs/fs.h
@@ -61,6 +61,7 @@ class FilesystemNode;
* List of multiple file system nodes. E.g. the contents of a given directory.
*/
class FSList : public Common::Array<FilesystemNode> {
+ void sort();
};
diff --git a/gui/browser.cpp b/gui/browser.cpp
index 1388aabf87..eeb13cd2b9 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -197,6 +197,7 @@ void BrowserDialog::updateListing() {
// Read in the data from the file system
_nodeContent = _node.listDir();
+ _nodeContent.sort();
// Populate the ListWidget
Common::StringList list;