@@ -79,7 +79,6 @@ - (NSString *) productName
7979
8080- (NSString *) discoverAppIcon
8181{
82- NSFileManager *mgr = [NSFileManager defaultManager ];
8382 NSString *filename = nil ;
8483 NSString *productName = [_target name ]; // [self productName];
8584 NSString *assetsDir = [productName stringByAppendingPathComponent: @" Assets.xcassets" ];
@@ -184,7 +183,10 @@ - (BOOL) copyAppIconToResources: (NSString *)iconFilename
184183 // Debug output for paths
185184 xcputs ([[NSString stringWithFormat: @" \t * Icon filename: '%@ '" , iconFilename] cString ]);
186185 xcputs ([[NSString stringWithFormat: @" \t * Source path: '%@ '" , imagePath] cString ]);
187- xcputs ([[NSString stringWithFormat: @" \t * Dest path: '%@ '" , destPath] cString ]);
186+ if (destPath != NULL && destPath != nil )
187+ {
188+ xcputs ([[NSString stringWithFormat: @" \t * Dest path: '%@ '" , destPath] cString ]);
189+ }
188190
189191 // Check if source file exists
190192 if (![mgr fileExistsAtPath: imagePath])
@@ -215,13 +217,22 @@ - (BOOL) copyAppIconToResources: (NSString *)iconFilename
215217 }
216218
217219 // Copy the icon file
218- BOOL success = [mgr copyItemAtPath: imagePath
219- toPath: destPath
220- error: &error];
220+ BOOL success = NO ;
221+ if (destPath != NULL && destPath != nil )
222+ {
223+ success = [mgr copyItemAtPath: imagePath
224+ toPath: destPath
225+ error: &error];
221226
222- if (!success)
227+ if (!success)
228+ {
229+ xcputs ([[NSString stringWithFormat: @" \t * ERROR: Failed to copy icon file: %@ " , error ? [error localizedDescription ] : @" Unknown error" ] cString ]);
230+ }
231+ }
232+ else
223233 {
224- xcputs ([[NSString stringWithFormat: @" \t * ERROR: Failed to copy icon file: %@ " , error ? [error localizedDescription ] : @" Unknown error" ] cString ]);
234+ success = YES ;
235+ xcputs (" \t * WARN: Not copying icon file, no destination provided" );
225236 }
226237
227238 return success;
0 commit comments