!366 lite关于图片编译的优化

Merge pull request !366 from fanjiaojiao/master
This commit is contained in:
openharmony_ci
2022-09-02 04:42:49 +00:00
committed by Gitee
2 changed files with 5 additions and 3 deletions
+4 -3
View File
@@ -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');
+1
View File
@@ -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) => {