function updateIcons()

in lib/prepare.js [528:552]


function updateIcons (cordovaProject, locations) {
    const icons = cordovaProject.projectConfig.getIcons('ios');

    if (icons.length === 0) {
        events.emit('verbose', 'This app does not have icons defined');
        return Promise.resolve();
    }

    const platformProjDir = path.relative(cordovaProject.root, locations.xcodeCordovaProj);
    const iconsDir = path.join(platformProjDir, 'Assets.xcassets', 'AppIcon.appiconset');

    return checkOrAssumeXcodeVersion()
        .then((xcodeversion) => {
            const resourceMap = mapIconResources(icons, iconsDir, xcodeversion);
            events.emit('verbose', `Updating icons at ${iconsDir}`);
            FileUpdater.updatePaths(
                resourceMap, { rootDir: cordovaProject.root }, logFileOp);

            // Now we need to update the AppIcon.appiconset/Contents.json file
            const contentsJSON = generateAppIconContentsJson(resourceMap);

            events.emit('verbose', 'Updating App Icon image set contents.json');
            fs.writeFileSync(path.join(cordovaProject.root, iconsDir, 'Contents.json'), JSON.stringify(contentsJSON, null, 2));
        });
}