From 45cbb6a006d70c0bfdfb3ff4bb3b6aac2fae429a Mon Sep 17 00:00:00 2001 From: Richard de Boer Date: Sun, 13 Mar 2022 22:20:32 +0100 Subject: [PATCH] boot: fix alphabetic sorting of *.boot.js files No version bump: assuming that where it really matters we already set a priority, which worked fine. --- apps/boot/bootupdate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/boot/bootupdate.js b/apps/boot/bootupdate.js index 63424bfbf..7a69bbaeb 100644 --- a/apps/boot/bootupdate.js +++ b/apps/boot/bootupdate.js @@ -196,7 +196,7 @@ if (!Bangle.appRect) { // added in 2v11 - polyfill for older firmwares // Append *.boot.js files // These could change bleServices/bleServiceOptions if needed var getPriority = /.*\.(\d+)\.boot\.js$/; -require('Storage').list(/\.boot\.js/).sort((a,b)=>{ +require('Storage').list(/\.boot\.js$/).sort((a,b)=>{ var aPriority = a.match(getPriority); var bPriority = b.match(getPriority); if (aPriority && bPriority){ @@ -206,7 +206,7 @@ require('Storage').list(/\.boot\.js/).sort((a,b)=>{ } else if (!aPriority && bPriority){ return 1; } - return a > b; + return a==b ? 0 : (a>b ? 1 : -1); }).forEach(bootFile=>{ // we add a semicolon so if the file is wrapped in (function(){ ... }() // with no semicolon we don't end up with (function(){ ... }()(function(){ ... }()