378 #pragma mark - |
378 #pragma mark - |
379 #pragma mark view management |
379 #pragma mark view management |
380 -(void) loadDataSourceArray { |
380 -(void) loadDataSourceArray { |
381 NSString *model = getModelType(); |
381 NSString *model = getModelType(); |
382 |
382 |
383 // themes.cfg contains all the user-selectable themes |
383 // only folders containing icon.png are a valid theme |
384 NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] |
384 NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; |
385 encoding:NSUTF8StringEncoding |
385 NSMutableArray *themeArray = [[NSMutableArray alloc] init]; |
386 error:NULL]; |
386 for (NSString *themeName in themeArrayFull) { |
387 NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; |
387 NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; |
388 [string release]; |
388 if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) |
389 // remove a trailing "" element |
389 [themeArray addObject:themeName]; |
390 [themeArray removeLastObject]; |
390 } |
391 |
391 |
392 // remove images that are too big for certain devices without loading the whole image |
392 // remove images that are too big for certain devices without loading the whole image |
393 NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
393 NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
394 NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
394 NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
395 for (NSString *str in mapArrayFull) { |
395 for (NSString *str in mapArrayFull) { |