Fix make_mapping

This commit is contained in:
Varun Patil 2020-10-20 19:37:08 +05:30
parent 4ce35c968b
commit 9b46b5ce91
2 changed files with 18 additions and 11 deletions

View File

@ -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);
}
// Create dummy file
FS.mkdir(filename);
} else {
FS.writeFile(filename, '1');
});
}
}
};
window.setBusy = function() {

View File

@ -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