From c721dbd3ba35dc6aa402a29a0eeb31db908fee82 Mon Sep 17 00:00:00 2001 From: Erisu Date: Thu, 30 Jun 2022 21:08:22 +0900 Subject: [PATCH] fix: support installing platfrom from local git checkout --- lib/prepare.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/prepare.js b/lib/prepare.js index bb97c400ea..a082bf2d84 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -553,9 +553,17 @@ function updateProjectSplashScreenImage (locations, themeKey, cdvConfigPrefKey, let possiblePreviousDestFilePath = path.join(destPngDir, destFileName + '.png'); // Default Drawable Source File - const defaultSrcFilePath = themeKey !== 'windowSplashScreenBrandingImage' - ? require.resolve('cordova-android/templates/project/res/drawable/' + destFileNameExt) - : null; + let defaultSrcFilePath = null; + + if (themeKey !== 'windowSplashScreenBrandingImage') { + try { + // coming from user project + defaultSrcFilePath = require.resolve('cordova-android/templates/project/res/drawable/' + destFileNameExt); + } catch (e) { + // coming from repo test & coho + defaultSrcFilePath = require.resolve('../templates/project/res/drawable/' + destFileNameExt); + } + } if (!cdvConfigPrefValue || !fs.existsSync(cdvConfigPrefValue)) { let emitType = 'verbose';