@@ -236,33 +236,36 @@ export class ProjectDataService implements IProjectDataService {
236236 private async getIOSAssetSubGroup ( dirPath : string ) : Promise < IAssetSubGroup > {
237237 const pathToContentJson = path . join ( dirPath , AssetConstants . iOSResourcesFileName ) ;
238238 const content = this . $fs . exists ( pathToContentJson ) && < IAssetSubGroup > this . $fs . readJson ( pathToContentJson ) || { images : [ ] } ;
239+ const finalContent : IAssetSubGroup = { images : [ ] } ;
239240
240241 const imageDefinitions = this . getImageDefinitions ( ) . ios ;
241242
242243 _ . each ( content && content . images , image => {
244+ let foundMatchingDefinition = false ;
243245 // In some cases the image may not be available, it will just be described.
244246 // When this happens, the filename will be empty.
245247 // So we'll keep the path empty as well.
246248 if ( image . filename ) {
247249 image . path = path . join ( dirPath , image . filename ) ;
248250 }
249251
252+ if ( image . size ) {
253+ // size is basically <width>x<height>
254+ const [ width , height ] = image . size . toString ( ) . split ( AssetConstants . sizeDelimiter ) ;
255+ if ( width && height ) {
256+ image . width = + width ;
257+ image . height = + height ;
258+ }
259+ }
260+
250261 // Find the image size based on the hardcoded values in the image-definitions.json
251262 _ . each ( imageDefinitions , ( assetSubGroup : IAssetItem [ ] ) => {
252263 const assetItem = _ . find ( assetSubGroup , assetElement =>
253264 assetElement . filename === image . filename && path . basename ( assetElement . directory ) === path . basename ( dirPath )
254265 ) ;
255266
256- if ( image . size ) {
257- // size is basically <width>x<height>
258- const [ width , height ] = image . size . toString ( ) . split ( AssetConstants . sizeDelimiter ) ;
259- if ( width && height ) {
260- image . width = + width ;
261- image . height = + height ;
262- }
263- }
264-
265267 if ( assetItem ) {
268+ foundMatchingDefinition = true ;
266269 if ( ! image . width || ! image . height ) {
267270 image . width = assetItem . width ;
268271 image . height = assetItem . height ;
@@ -273,13 +276,18 @@ export class ProjectDataService implements IProjectDataService {
273276 image . overlayImageScale = image . overlayImageScale || assetItem . overlayImageScale ;
274277 image . scale = image . scale || assetItem . scale ;
275278 image . rgba = assetItem . rgba ;
279+ finalContent . images . push ( image ) ;
276280 // break each
277281 return false ;
278282 }
279283 } ) ;
284+
285+ if ( ! foundMatchingDefinition && image . filename ) {
286+ this . $logger . warn ( `Didn't find a matching image definition for file ${ path . join ( path . basename ( dirPath ) , image . filename ) } . This file will be skipped from reources generation.` ) ;
287+ }
280288 } ) ;
281289
282- return content ;
290+ return finalContent ;
283291 }
284292
285293 private getAndroidAssetSubGroup ( assetItems : IAssetItem [ ] , realPaths : string [ ] ) : IAssetSubGroup {
0 commit comments