mirror of
https://github.com/openharmony/developtools_ace-js2bundle.git
synced 2026-07-20 21:59:23 -04:00
@@ -16,7 +16,6 @@
|
||||
const Jimp = require('jimp');
|
||||
const fs = require('fs');
|
||||
const _path = require('path');
|
||||
const { readManifest} = require('../../main.product');
|
||||
/**
|
||||
* Find all image paths in png、jpg、bmp、jpeg format in the directory.
|
||||
* @param {String} imgPath The path of build folder.
|
||||
@@ -38,10 +37,6 @@ async function img2bin(imgPath) {
|
||||
const header = (image.bitmap.width << WIDTH_BIT_OFFSET) +
|
||||
(image.bitmap.height << HEIGHT_BIT_OFFSET);
|
||||
|
||||
process.env.aceManifestPath = process.env.aceManifestPath || path.resolve(process.env.projectPath, 'manifest.json');
|
||||
const manifest = readManifest(process.env.aceManifestPath)
|
||||
const version = parseInt(manifest.minPlatformVersion);
|
||||
|
||||
let binFileOffset = 0;
|
||||
binView.setUint32(binFileOffset, COLOR_MODE, true);
|
||||
binFileOffset += 4;
|
||||
@@ -70,7 +65,7 @@ async function img2bin(imgPath) {
|
||||
binFileOffset += 1;
|
||||
});
|
||||
|
||||
if (version <=6) {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user