From 41cbec1f2624593011b11b8456b3271a1af799b5 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Mon, 20 Apr 2020 12:45:05 +0200 Subject: [PATCH] sort single file ZIP files correctly (fixes #612) --- src/emucore/FSNode.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/emucore/FSNode.cxx b/src/emucore/FSNode.cxx index 6965839ef..64af7212e 100644 --- a/src/emucore/FSNode.cxx +++ b/src/emucore/FSNode.cxx @@ -58,6 +58,20 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode, if (!_realNode->getChildren(tmp, mode)) return false; + #if defined(ZIP_SUPPORT) + // before sorting, replace single file ZIP archive names with contained file names + // because they are displayed using their contained file names + for (auto& i : tmp) + { + if (BSPF::endsWithIgnoreCase(i->getPath(), ".zip")) + { + FilesystemNodeZIP node(i->getPath()); + + i->setName(node.getName()); + } + } + #endif + std::sort(tmp.begin(), tmp.end(), [](const AbstractFSNodePtr& node1, const AbstractFSNodePtr& node2) {