diff --git a/ChangeLog b/ChangeLog index b2ff2f50d..80459bb3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-17 Nicola Pero + + * Source/NSBundle.m ([+bundleForLibrary:version:]): Fixed looking + up library resource bundle when no version is provided. + 2007-03-16 Richard Frith-Macdonald * Source/unix/NSStream.m: diff --git a/Source/NSBundle.m b/Source/NSBundle.m index a302c5dbe..48abac43e 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -2273,14 +2273,19 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory) /* Any version will do. */ NSString *versionsPath = [[path stringByAppendingPathComponent: libraryName] stringByAppendingPathComponent: @"Versions"]; + if ([fm fileExistsAtPath: versionsPath isDirectory: &isDir] && isDir) { + /* TODO: Ignore subdirectories. */ NSEnumerator *fileEnumerator = [fm enumeratorAtPath: versionsPath]; NSString *potentialPath; while ((potentialPath = [fileEnumerator nextObject]) != nil) { - potentialPath = [potentialPath stringByAppendingPathComponent: @"Resources"]; + potentialPath = [versionsPath + stringByAppendingPathComponent: + [potentialPath + stringByAppendingPathComponent: @"Resources"]]; if ([fm fileExistsAtPath: potentialPath isDirectory: &isDir] && isDir) { b = [self bundleWithPath: potentialPath];