aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/fs/fs.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/backends/fs/fs.h b/backends/fs/fs.h
index 302027ba45..3b9254f512 100644
--- a/backends/fs/fs.h
+++ b/backends/fs/fs.h
@@ -131,10 +131,15 @@ public:
virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const = 0;
/**
- * Compare the name of this node to the name of another.
+ * Compare the name of this node to the name of another. Directories
+ * go before normal files.
*/
virtual bool operator< (const AbstractFilesystemNode& node) const
{
+ if (isDirectory() && !node.isDirectory())
+ return true;
+ if (!isDirectory() && node.isDirectory())
+ return false;
return scumm_stricmp(displayName().c_str(), node.displayName().c_str()) < 0;
}