From 3157fa022efe1a956b24bec1462b74ffe9800a25 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 3 May 2016 20:31:45 -0400 Subject: [PATCH] (fix) we now load 'base products' before any other ones --- SoObjects/SOGo/SOGoProductLoader.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/SoObjects/SOGo/SOGoProductLoader.m b/SoObjects/SOGo/SOGoProductLoader.m index aaeb7e0b0..be63d6912 100644 --- a/SoObjects/SOGo/SOGoProductLoader.m +++ b/SoObjects/SOGo/SOGoProductLoader.m @@ -30,11 +30,13 @@ #import "SOGoProductLoader.h" static NSString *productDirectoryName = @"SOGo"; +static NSArray *baseProducts; @implementation SOGoProductLoader + (id) productLoader { + baseProducts = [[NSArray alloc] initWithObjects: @"Appointments.SOGo", @"Contacts.SOGo", @"Mailer.SOGo", @"CommonUI.SOGo", @"MainUI.SOGo", nil]; return [[self new] autorelease]; } @@ -105,7 +107,7 @@ static NSString *productDirectoryName = @"SOGo"; { SoProductRegistry *registry = nil; NSFileManager *fm; - NSMutableArray *loadedProducts; + NSMutableArray *loadedProducts, *remainingProducts; NSEnumerator *pathes; NSString *lpath, *bpath; NSEnumerator *productNames; @@ -122,7 +124,20 @@ static NSString *productDirectoryName = @"SOGo"; pathes = [[self productSearchPathes] objectEnumerator]; while ((lpath = [pathes nextObject])) { - productNames = [[fm directoryContentsAtPath: lpath] objectEnumerator]; + productNames = [baseProducts objectEnumerator]; + while ((productName = [productNames nextObject])) + { + bpath = [lpath stringByAppendingPathComponent: productName]; + if ([fm fileExistsAtPath: bpath]) + { + [registry registerProductAtPath: bpath]; + [loadedProducts addObject: productName]; + } + } + + remainingProducts = [NSMutableArray arrayWithArray: [fm directoryContentsAtPath: lpath]]; + [remainingProducts removeObjectsInArray: baseProducts]; + productNames = [remainingProducts objectEnumerator]; while ((productName = [productNames nextObject])) { if ([[productName pathExtension] isEqualToString: @"SOGo"])