Skip to content

Commit ebe4eea

Browse files
committed
Revert "Create a safe copy of the app icon"
This reverts commit 01f91a4.
1 parent 01f91a4 commit ebe4eea

File tree

4 files changed

+3
-153
lines changed

4 files changed

+3
-153
lines changed

Generators/Makefile/GSXCMakefileGenerator.m

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ - (BOOL) generate
7575
NSString *additionalIncludes = [self safeStringFromArray: [context objectForKey: @"ADDITIONAL_INCLUDE_DIRS"] withMethod: @selector(arrayToIncludeList)];
7676
NSString *additionalOCflags = [self safeStringFromArray: [context objectForKey: @"ADDITIONAL_OBJC_LIBS"] withMethod: @selector(arrayToLinkList)];
7777
NSString *projectType = [context objectForKey: @"PROJECT_TYPE"];
78-
79-
// Get app icon information from build context
80-
NSString *appIconFile = [context objectForKey: @"APP_ICON_FILE"];
81-
NSString *safeAppIconFile = [context objectForKey: @"APP_ICON_SAFE_FILE"];
8278

8379
// Debug output to see what we're getting from the context
8480
NSDebugLog(@"=== DEBUG: Makefile Generator Context ===");
@@ -88,8 +84,6 @@ - (BOOL) generate
8884
NSDebugLog(@"OBJCPP_FILES: %@", [context objectForKey: @"OBJCPP_FILES"]);
8985
NSDebugLog(@"RESOURCES: %@", [context objectForKey: @"RESOURCES"]);
9086
NSDebugLog(@"PROJECT_TYPE: %@", projectType);
91-
NSDebugLog(@"APP_ICON_FILE: %@", appIconFile);
92-
NSDebugLog(@"APP_ICON_SAFE_FILE: %@", safeAppIconFile);
9387
NSDebugLog(@"========================================");
9488

9589
// Construct the makefile out of the data we have thusfar collected.
@@ -149,23 +143,6 @@ - (BOOL) generate
149143
[NSString stringWithFormat: @"%@_RESOURCE_FILES = %@\n\n", appName, resourceFilesString]];
150144
}
151145

152-
// Add app icon handling if an icon was discovered
153-
if (appIconFile != nil && [projectType isEqualToString: @"application"])
154-
{
155-
NSString *iconToUse = safeAppIconFile ? safeAppIconFile : appIconFile;
156-
makefileString = [makefileString stringByAppendingString: @"# App icon handling\n"];
157-
makefileString = [makefileString stringByAppendingString:
158-
[NSString stringWithFormat: @"%@_MAIN_MODEL_FILE = %@\n", appName, iconToUse]];
159-
160-
// Add a rule to copy the app icon to the app bundle
161-
makefileString = [makefileString stringByAppendingString: @"# Copy app icon to Resources directory\n"];
162-
makefileString = [makefileString stringByAppendingString:
163-
[NSString stringWithFormat: @"after-install::\n\t$(INSTALL_DATA) %@ $(GNUSTEP_APP_INSTALL_DIR)/%@.app/Resources/\n\n",
164-
iconToUse, appName]];
165-
166-
xcputs([[NSString stringWithFormat: @"\t* Added app icon to makefile: %@", iconToUse] cString]);
167-
}
168-
169146
if ([additionalIncludes length] > 0)
170147
{
171148
makefileString = [makefileString stringByAppendingString:

XCode/PBXResourcesBuildPhase.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@
5555
*/
5656
- (BOOL) copyAppIconToResources: (NSString *)iconFilename;
5757

58-
/**
59-
* Creates a safe copy of the app icon file with spaces replaced by underscores.
60-
* If the icon filename contains spaces, creates a copy with a makefile-safe name.
61-
* Takes the name of the icon file to process as parameter.
62-
* Returns the safe filename if a copy was created, or nil if no spaces were found.
63-
*/
64-
- (NSString *) createSafeIconCopy: (NSString *)iconFilename;
65-
6658
/**
6759
* Escapes special characters in filenames for makefile compatibility.
6860
* Handles spaces, dollar signs, hash symbols, and colons that have special

XCode/PBXResourcesBuildPhase.m

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -238,46 +238,6 @@ - (BOOL) copyAppIconToResources: (NSString *)iconFilename
238238
return success;
239239
}
240240

241-
- (NSString *) createSafeIconCopy: (NSString *)iconFilename
242-
{
243-
if (iconFilename == nil || [iconFilename rangeOfString: @" "].location == NSNotFound)
244-
{
245-
// No spaces, return original filename
246-
return nil;
247-
}
248-
249-
NSFileManager *mgr = [NSFileManager defaultManager];
250-
NSString *productName = [_target name];
251-
NSString *assetsDir = [productName stringByAppendingPathComponent: @"Assets.xcassets"];
252-
NSString *appIconDir = [assetsDir stringByAppendingPathComponent: @"AppIcon.appiconset"];
253-
NSString *sourcePath = [appIconDir stringByAppendingPathComponent: iconFilename];
254-
255-
// Create safe filename by replacing spaces with underscores
256-
NSString *safeFilename = [iconFilename stringByReplacingOccurrencesOfString: @" " withString: @"_"];
257-
NSString *safePath = [appIconDir stringByAppendingPathComponent: safeFilename];
258-
259-
xcputs([[NSString stringWithFormat: @"\t* Creating safe icon copy: %@ -> %@", iconFilename, safeFilename] cString]);
260-
261-
// Copy original to safe filename
262-
NSError *error = nil;
263-
if ([mgr fileExistsAtPath: safePath])
264-
{
265-
[mgr removeItemAtPath: safePath error: NULL];
266-
}
267-
268-
BOOL success = [mgr copyItemAtPath: sourcePath toPath: safePath error: &error];
269-
if (success)
270-
{
271-
xcputs([[NSString stringWithFormat: @"\t* Successfully created safe icon copy: %@", safeFilename] cString]);
272-
return safeFilename;
273-
}
274-
else
275-
{
276-
xcputs([[NSString stringWithFormat: @"\t* ERROR: Failed to create safe icon copy: %@", error ? [error localizedDescription] : @"Unknown error"] cString]);
277-
return nil;
278-
}
279-
}
280-
281241
- (NSString *) processAssets
282242
{
283243
NSString *filename = [self discoverAppIcon];
@@ -665,32 +625,18 @@ - (BOOL) generate
665625
NSString *iconPath = [self discoverAppIconPath];
666626
xcputs([[NSString stringWithFormat: @"\t* Discovered app icon: %@", iconFile ? iconFile : @"(none)"] cString]);
667627

668-
// Store app icon information in build context for makefile generation
669-
GSXCBuildContext *context = [GSXCBuildContext sharedBuildContext];
670-
if (iconFile != nil)
671-
{
672-
[context setObject: iconFile forKey: @"APP_ICON_FILE"];
673-
xcputs([[NSString stringWithFormat: @"\t* Stored app icon in build context: %@", iconFile] cString]);
674-
}
675-
676628
// Add icon file to resources if found
677629
if (iconPath != nil)
678630
{
679631
NSString *escapedIconPath = [self escapeFilenameForMakefile: iconPath];
680632
xcputs([[NSString stringWithFormat: @"\t* Adding app icon to resources: %@", iconPath] cString]);
681633
[resources addObject: escapedIconPath];
682634

683-
// Copy app icon to resources directory with safe filename
684-
NSString *safeIconFile = [self createSafeIconCopy: iconFile];
685-
BOOL iconCopied = [self copyAppIconToResources: safeIconFile ? safeIconFile : iconFile];
635+
// Copy app icon to resources directory
636+
BOOL iconCopied = [self copyAppIconToResources: iconFile];
686637
if (iconCopied)
687638
{
688-
xcputs([[NSString stringWithFormat: @"\t* Copied app icon to resources: %@", safeIconFile ? safeIconFile : iconFile] cString]);
689-
// Store the safe filename for makefile generation
690-
if (safeIconFile != nil)
691-
{
692-
[context setObject: safeIconFile forKey: @"APP_ICON_SAFE_FILE"];
693-
}
639+
xcputs([[NSString stringWithFormat: @"\t* Copied app icon to resources: %@", iconFile] cString]);
694640
}
695641
else
696642
{

test_app_icon.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)