From 2c190564d4e76d974c7d963097b2bb558b9521d6 Mon Sep 17 00:00:00 2001 From: Martijn Walraven Date: Wed, 13 Jan 2016 11:53:06 +0100 Subject: [PATCH] Check if default app icon and launch screen images exist before copying --- tools/cordova/builder.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/cordova/builder.js b/tools/cordova/builder.js index e3e4b2c7d9..d2f6ac4ade 100644 --- a/tools/cordova/builder.js +++ b/tools/cordova/builder.js @@ -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 = {}; }