Skip to content

Commit

Permalink
sort zipped files by name and folder
Browse files Browse the repository at this point in the history
  • Loading branch information
marcrobledo committed Jul 21, 2024
1 parent 85f06ca commit 41174df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion _cache_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
<button id="button-settings" class="button-outer"><img src="style/icon_settings.svg" class="icon settings" /> <span data-localize="settings">Settings</span></button>
</div>

Rom Patcher JS <small>v2.9</small> by <a href="/">Marc Robledo</a>
Rom Patcher JS <small>v2.9.1</small> by <a href="/">Marc Robledo</a>
<br />
<img src="style/icon_github.svg" class="icon github" /> <a href="https://github.com/marcrobledo/RomPatcher.js/" target="_blank">See on GitHub</a>
<img src="style/icon_heart.svg" class="icon heart" /> <a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow">Donate</a>
Expand Down
12 changes: 11 additions & 1 deletion js/formats/zip.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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;
});



Expand Down

0 comments on commit 41174df

Please sign in to comment.