From 41174df6c5667fac717b5022e73f77bbc6ecdbf4 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 21 Jul 2024 12:52:54 +0200 Subject: [PATCH] sort zipped files by name and folder --- _cache_service_worker.js | 2 +- index.html | 2 +- js/formats/zip.js | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/_cache_service_worker.js b/_cache_service_worker.js index f71307c..a10b242 100644 --- a/_cache_service_worker.js +++ b/_cache_service_worker.js @@ -14,7 +14,7 @@ */ var PRECACHE_ID='rom-patcher-js'; -var PRECACHE_VERSION='v29'; +var PRECACHE_VERSION='v291'; var PRECACHE_URLS=[ '/RomPatcher.js/','/RomPatcher.js/index.html', '/RomPatcher.js/manifest.json', diff --git a/index.html b/index.html index 12f7b2b..1f41641 100644 --- a/index.html +++ b/index.html @@ -181,7 +181,7 @@ - Rom Patcher JS v2.9 by Marc Robledo + Rom Patcher JS v2.9.1 by Marc Robledo
See on GitHub Donate diff --git a/js/formats/zip.js b/js/formats/zip.js index f5c28f0..46dba1e 100644 --- a/js/formats/zip.js +++ b/js/formats/zip.js @@ -1,4 +1,4 @@ -/* ZIP module for Rom Patcher JS v20220319 - Marc Robledo 2016-2022 - http://www.marcrobledo.com/license */ +/* ZIP module for Rom Patcher JS v20230721 - Marc Robledo 2016-2024 - http://www.marcrobledo.com/license */ const ZIP_MAGIC='\x50\x4b\x03\x04'; @@ -51,6 +51,16 @@ var ZIPManager=(function(){ filteredEntries.push(zipEntries[i]); } } + /* sort patch files by name and folder */ + filteredEntries + .sort(function(file1, file2){ + return file1.filename.toLowerCase().localeCompare(file2.filename.toLowerCase()); + }) + .sort(function(file1, file2){ + var file1Folder=file1.filename.indexOf('/')===-1? 0 : 1; + var file2Folder=file2.filename.indexOf('/')===-1? 0 : 1; + return file1Folder - file2Folder; + });