Check if default app icon and launch screen images exist before copying

This commit is contained in:
Martijn Walraven
2016-01-13 11:53:06 +01:00
parent b05cd35577
commit 2c190564d4

View File

@@ -154,19 +154,24 @@ export class CordovaBuilder {
const iconsPath = files.pathJoin(assetsPath, 'icons');
const launchScreensPath = files.pathJoin(assetsPath, 'launchscreens');
const setIcon = (size, name) => {
this.imagePaths.icon[name] = files.pathJoin(iconsPath, size + '.png');
const setDefaultIcon = (size, name) => {
const imageFile = files.pathJoin(iconsPath, size + '.png');
if (files.exists(imageFile)) {
this.imagePaths.icon[name] = imageFile;
}
};
const setLaunchscreen = (size, name) => {
this.imagePaths.splash[name] =
files.pathJoin(launchScreensPath, `${size}.png`);
const setDefaultLaunchScreen = (size, name) => {
const imageFile = files.pathJoin(launchScreensPath, `${size}.png`);
if (files.exists(imageFile)) {
this.imagePaths.splash[name] = imageFile;
}
};
_.each(iconsIosSizes, setIcon);
_.each(iconsAndroidSizes, setIcon);
_.each(launchIosSizes, setLaunchscreen);
_.each(launchAndroidSizes, setLaunchscreen);
_.each(iconsIosSizes, setDefaultIcon);
_.each(iconsAndroidSizes, setDefaultIcon);
_.each(launchIosSizes, setDefaultLaunchScreen);
_.each(launchAndroidSizes, setDefaultLaunchScreen);
this.pluginsConfiguration = {};
}