Monotone-Parent: f69c7f912f9958f232e0641fbdf872d37a2aa9bd

Monotone-Revision: 0575b0625d349718d3a000c6d46cac95612e6cfb

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-02-18T22:34:51
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-02-18 22:34:51 +00:00
parent bb13d2b0b5
commit f0ba13c1dc
4 changed files with 58 additions and 10 deletions

View File

@ -1,5 +1,11 @@
2010-02-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoProductLoader.m (-loadAllProducts): new name
for "loadProducts". Do not list product directories where no
products were loaded.
(-loadProducts:): new method accepting an array of products to
load from SOGo library directories.
* SoObjects/SOGo/SOGoBuild.m: moved from Main/build.h to here.
* SoObjects/SOGo/SOGoProductLoader.m: moved from Main/ to here.

View File

@ -134,7 +134,7 @@ static BOOL debugLeaks;
localeLUT = [[NSMutableDictionary alloc] initWithCapacity:2];
/* load products */
[[SOGoProductLoader productLoader] loadProducts];
[[SOGoProductLoader productLoader] loadAllProducts];
/* setup resource manager */
rm = [[WEResourceManager alloc] init];

View File

@ -32,11 +32,12 @@
NSArray *searchPathes;
}
+ (id)productLoader;
+ (id) productLoader;
/* operations */
- (void)loadProducts;
- (void) loadAllProducts;
- (void) loadProducts: (NSArray *) products;
@end

View File

@ -103,7 +103,52 @@ static NSString *productDirectoryName = @"SOGo";
return searchPathes;
}
- (void) loadProducts
- (void) loadAllProducts
{
SoProductRegistry *registry = nil;
NSFileManager *fm;
NSMutableArray *loadedProducts;
NSEnumerator *pathes;
NSString *lpath, *bpath;
NSEnumerator *productNames;
NSString *productName;
NSAutoreleasePool *pool;
pool = [NSAutoreleasePool new];
registry = [SoProductRegistry sharedProductRegistry];
fm = [NSFileManager defaultManager];
loadedProducts = [NSMutableArray array];
pathes = [[self productSearchPathes] objectEnumerator];
while ((lpath = [pathes nextObject]))
{
productNames = [[fm directoryContentsAtPath: lpath] objectEnumerator];
while ((productName = [productNames nextObject]))
{
if ([[productName pathExtension] isEqualToString: @"SOGo"])
{
bpath = [lpath stringByAppendingPathComponent: productName];
[registry registerProductAtPath: bpath];
[loadedProducts addObject: productName];
}
}
if ([loadedProducts count])
{
[self logWithFormat: @"SOGo products loaded from '%@':", lpath];
[self logWithFormat: @" %@",
[loadedProducts componentsJoinedByString: @", "]];
[loadedProducts removeAllObjects];
}
}
if (![registry loadAllProducts])
[self warnWithFormat: @"could not load all products !"];
[pool release];
}
- (void) loadProducts: (NSArray *) products
{
SoProductRegistry *registry = nil;
NSFileManager *fm;
@ -121,16 +166,12 @@ static NSString *productDirectoryName = @"SOGo";
pathes = [[self productSearchPathes] objectEnumerator];
while ((lpath = [pathes nextObject]))
{
[self logWithFormat: @"scanning SOGo products in: %@", lpath];
productNames = [[fm directoryContentsAtPath: lpath] objectEnumerator];
while ((productName = [productNames nextObject]))
{
if ([[productName pathExtension] isEqualToString: @"SOGo"])
{
if ([products containsObject: productName])
{
bpath = [lpath stringByAppendingPathComponent: productName];
[self logWithFormat: @" register SOGo product: %@",
productName];
[registry registerProductAtPath: bpath];
}
}