-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcopyIcon.js
More file actions
25 lines (21 loc) · 786 Bytes
/
copyIcon.js
File metadata and controls
25 lines (21 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require('fs');
const path = require('path');
const parseString = require('xml2js').parseString;
console.log("Copying Icons");
let copy = (src, dest) => {
fs.writeFileSync(dest, fs.readFileSync(src));
console.log(`${src} copied to ${dest}`);
};
parseString(fs.readFileSync("config.xml").toString(), function (error, result) {
if (error) {
return console.error(error);
}
let iconPath = path.resolve(__dirname, result.widget["app-icon"][0].$.src);
console.log(`Icon is ${iconPath}`);
let folders = fs.readdirSync(`${__dirname}/platforms/android/res`);
folders.forEach((folder) => {
if (folder.startsWith("drawable")) {
copy(iconPath, `${__dirname}/platforms/android/res/${folder}/icon.png`);
}
});
});