Skip to content

Commit 4d6dcb5

Browse files
committed
Update how we copy the resources
1 parent 00f3f7d commit 4d6dcb5

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

XCode/PBXResourcesBuildPhase.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@
7979
*/
8080
- (NSString *) generateInfoPlistOutput: (NSString *)outputPlist withIconFile: (NSString *)iconFile;
8181

82-
/**
83-
* Converts build configuration to Info.plist dictionary.
84-
* Extracts relevant settings from the build configuration for plist generation.
85-
* Takes the build configuration to process as parameter.
86-
* Returns a mutable dictionary containing plist key-value pairs.
87-
*/
88-
- (NSMutableDictionary *) configToInfoPlist: (XCBuildConfiguration *)config;
89-
9082
/**
9183
* Converts build configuration to Info.plist dictionary with icon information.
9284
* Extracts settings and includes icon file reference in the generated dictionary.

XCode/PBXResourcesBuildPhase.m

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)