diff --git a/ace-loader/src/lite/lite-image2bin.js b/ace-loader/src/lite/lite-image2bin.js index fdd99f0..6c2a895 100644 --- a/ace-loader/src/lite/lite-image2bin.js +++ b/ace-loader/src/lite/lite-image2bin.js @@ -64,11 +64,12 @@ async function img2bin(imgPath) { binView.setUint8(binFileOffset, alpha, true); binFileOffset += 1; }); - const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin'); + if (process.env.PLATFORM_VERSION_VERSION <=6) { + const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin'); + fs.writeFileSync(binPath1, Buffer.from(binBuffer)); + } const binPath2 = imgPath+".bin"; - fs.writeFileSync(binPath1, Buffer.from(binBuffer)); fs.writeFileSync(binPath2, Buffer.from(binBuffer)); - } catch (err) { const imageName = _path.basename(imgPath); console.error('\u001b[31m', `Failed to convert image ${imageName}.`, '\u001b[39m'); diff --git a/ace-loader/webpack.lite.config.js b/ace-loader/webpack.lite.config.js index 1211a22..4202075 100644 --- a/ace-loader/webpack.lite.config.js +++ b/ace-loader/webpack.lite.config.js @@ -131,6 +131,7 @@ function setConfigs(env) { if (version <= 4) { process.env.PLATFORM_VERSION = PLATFORM.VERSION3; } + process.env.PLATFORM_VERSION_VERSION = version; } module.exports = (env) => {