Skip to content

Commit 8105284

Browse files
committed
fix: create_mipmap_images.js
1 parent 022d36f commit 8105284

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

create_mipmap_images.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { Jimp } = require('jimp');
2+
const fs = require('fs');
23

34
const sizes = {
45
xxxhdpi: 192,
@@ -13,13 +14,16 @@ async function main(imageUrl) {
1314
const image = await Jimp.read(imageUrl);
1415
image.resize({ w: 512, h: 512 }).write('app/src/main/ic_launcher-playstore.png');
1516
for (const [sizeName, sizePixels] of Object.entries(sizes)) {
17+
const mipmapFolder = `app/src/main/res/mipmap-${sizeName}`;
18+
if (!fs.existsSync(mipmapFolder)) {
19+
fs.mkdirSync(mipmapFolder, { recursive: true });
20+
}
1621
const launcherPath = `app/src/main/res/mipmap-${sizeName}/ic_launcher.png`;
1722
const roundPath = `app/src/main/res/mipmap-${sizeName}/ic_launcher_round.png`;
1823
image.resize({ w: sizePixels, h: sizePixels }).write(launcherPath);
1924
image.circle().write(roundPath);
2025
}
2126
}
22-
2327
if (require.main === module) {
2428
const arg = process.argv[2];
2529
if (!arg) throw new Error('missing argument');

0 commit comments

Comments
 (0)