Skip to content

Commit 0065e7a

Browse files
committed
Separate interfaces, images, etc into proper categories
1 parent 4135600 commit 0065e7a

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

Generators/ProjectBuilder/GSXCProjectBuilderGenerator.m

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,73 @@ - (BOOL) generate
166166
[filesTable setObject: headerFiles forKey: @"H_FILES"];
167167
}
168168

169+
// Separate resource files into interfaces, images, and other categories
169170
if ([self arrayHasValidContent: resourceFiles])
170171
{
171-
// ProjectBuilder uses INTERFACES for NIB/interface files, but we'll put resources here
172-
[filesTable setObject: resourceFiles forKey: @"INTERFACES"];
172+
NSMutableArray *interfaces = [NSMutableArray array];
173+
NSMutableArray *images = [NSMutableArray array];
174+
NSMutableArray *otherResources = [NSMutableArray array];
175+
NSEnumerator *en = [resourceFiles objectEnumerator];
176+
NSString *resourceFile = nil;
177+
178+
while ((resourceFile = [en nextObject]) != nil)
179+
{
180+
NSString *ext = [[resourceFile pathExtension] lowercaseString];
181+
182+
// NIB/XIB files go into INTERFACES
183+
if ([ext isEqualToString: @"nib"] ||
184+
[ext isEqualToString: @"xib"] ||
185+
[ext isEqualToString: @"gorm"])
186+
{
187+
[interfaces addObject: resourceFile];
188+
}
189+
// Image files go into IMAGES
190+
else if ([ext isEqualToString: @"png"] ||
191+
[ext isEqualToString: @"jpg"] ||
192+
[ext isEqualToString: @"jpeg"] ||
193+
[ext isEqualToString: @"gif"] ||
194+
[ext isEqualToString: @"tiff"] ||
195+
[ext isEqualToString: @"tif"] ||
196+
[ext isEqualToString: @"bmp"] ||
197+
[ext isEqualToString: @"ico"] ||
198+
[ext isEqualToString: @"icns"] ||
199+
[ext isEqualToString: @"pdf"] ||
200+
[ext isEqualToString: @"svg"])
201+
{
202+
[images addObject: resourceFile];
203+
}
204+
// Everything else goes into other resources
205+
else
206+
{
207+
[otherResources addObject: resourceFile];
208+
}
209+
}
210+
211+
if ([interfaces count] > 0)
212+
{
213+
[filesTable setObject: interfaces forKey: @"INTERFACES"];
214+
}
215+
if ([images count] > 0)
216+
{
217+
[filesTable setObject: images forKey: @"IMAGES"];
218+
}
219+
// Add other resources to OTHER_LINKED if they exist
220+
if ([otherResources count] > 0)
221+
{
222+
NSMutableArray *otherLinked = [NSMutableArray array];
223+
if ([self arrayHasValidContent: otherSources])
224+
{
225+
[otherLinked addObjectsFromArray: otherSources];
226+
}
227+
[otherLinked addObjectsFromArray: otherResources];
228+
[filesTable setObject: otherLinked forKey: @"OTHER_LINKED"];
229+
}
230+
else if ([self arrayHasValidContent: otherSources])
231+
{
232+
[filesTable setObject: otherSources forKey: @"OTHER_LINKED"];
233+
}
173234
}
174-
175-
if ([self arrayHasValidContent: otherSources])
235+
else if ([self arrayHasValidContent: otherSources])
176236
{
177237
[filesTable setObject: otherSources forKey: @"OTHER_LINKED"];
178238
}

0 commit comments

Comments
 (0)