diff --git a/extra/js/drive.js b/extra/js/drive.js index ab27304..839cd77 100644 --- a/extra/js/drive.js +++ b/extra/js/drive.js @@ -135,18 +135,18 @@ var createDummies = function() { FS.mkdir('/game'); // Create dummy objects - Object.values(mapping).forEach((file) => { + for (var i = 0; i < mappingArray.length; i++) { // Get filename + const file = mappingArray[i][1]; const filename = '/game/' + file.split("?")[0]; // Check if folder if (file.endsWith('h=')) { - return FS.mkdir(filename); + FS.mkdir(filename); + } else { + FS.writeFile(filename, '1'); } - - // Create dummy file - FS.writeFile(filename, '1'); - }); + } }; window.setBusy = function() { diff --git a/extra/make_mapping.sh b/extra/make_mapping.sh index 29cce7a..81f6e46 100755 --- a/extra/make_mapping.sh +++ b/extra/make_mapping.sh @@ -1,10 +1,10 @@ #!/bin/bash -echo "var mapping = {" > mapping.js +echo "var mappingArray = [" > mapping.js echo "var bitmapSizeMapping = {" > bitmap-map.js -for file in {*,*/*,*/**/*,*/**/**/*} -do +shopt -s globstar +for file in **/*; do filename="${file%.*}" fl="$(echo "$filename" | tr '[:upper:]' '[:lower:]')" @@ -27,10 +27,17 @@ else md5='' fi -echo "\"$fl\": \"${file}?h=${md5}\"," >> mapping.js +echo "[\"$fl\", \"${file}?h=${md5}\"]," >> mapping.js done -echo "};" >> mapping.js +echo "];" >> mapping.js echo "};" >> bitmap-map.js +echo " +var mapping = {}; +for (var i = 0; i < mappingArray.length; i++) { + mapping[mappingArray[i][0]] = mappingArray[i][1]; +} +" >> mapping.js +