I created a patch to fix issue number 587. The content of a zip file will now be listed ascending by the filename.
Hope you like it, but every hint or comment for improvement is (of course) welcome
Ciao
Donut
- Code: Select all
Index: net/pms/dlna/ZippedFile.java
===================================================================
--- net/pms/dlna/ZippedFile.java (revision 704)
+++ net/pms/dlna/ZippedFile.java (working copy)
@@ -23,6 +23,10 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
@@ -45,8 +49,18 @@
try {
zip = new ZipFile(z);
Enumeration<? extends ZipEntry> enm = zip.entries();
+ List<ZipEntry> zipEntryList = new ArrayList<ZipEntry>();
while (enm.hasMoreElements()) {
- ZipEntry ze = enm.nextElement();
+ zipEntryList.add(enm.nextElement());
+ }
+ Collections.sort(zipEntryList, new Comparator<ZipEntry>() {
+
+ @Override
+ public int compare(ZipEntry o1, ZipEntry o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+ for(ZipEntry ze: zipEntryList){
addChild(new ZippedEntry(z, ze.getName(), ze.getSize()));
}
zip.close();
