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'); FS.mkdir('/game');
// Create dummy objects // Create dummy objects
Object.values(mapping).forEach((file) => { for (var i = 0; i < mappingArray.length; i++) {
// Get filename // Get filename
const file = mappingArray[i][1];
const filename = '/game/' + file.split("?")[0]; const filename = '/game/' + file.split("?")[0];
// Check if folder // Check if folder
if (file.endsWith('h=')) { 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() { window.setBusy = function() {

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
echo "var mapping = {" > mapping.js echo "var mappingArray = [" > mapping.js
echo "var bitmapSizeMapping = {" > bitmap-map.js echo "var bitmapSizeMapping = {" > bitmap-map.js
for file in {*,*/*,*/**/*,*/**/**/*} shopt -s globstar
do for file in **/*; do
filename="${file%.*}" filename="${file%.*}"
fl="$(echo "$filename" | tr '[:upper:]' '[:lower:]')" fl="$(echo "$filename" | tr '[:upper:]' '[:lower:]')"
@ -27,10 +27,17 @@ else
md5='' md5=''
fi fi
echo "\"$fl\": \"${file}?h=${md5}\"," >> mapping.js echo "[\"$fl\", \"${file}?h=${md5}\"]," >> mapping.js
done done
echo "};" >> mapping.js echo "];" >> mapping.js
echo "};" >> bitmap-map.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