Fixed: CPBundle -bundleWithIdentifier did not create CPBundle when necessary.

Previously, if a CFBundle with the given identifier had been loaded, but no CPBundle had yet been created with the given identifier, -bundleWithIdentifier would return nil instead of a newly constructed CPBundle with the CFBundle's URL.

This commit correctly returns a newly constructed CPBundle when a CFBundle is found.
This commit is contained in:
Aparajita Fishman
2013-04-06 16:20:21 -04:00
parent cc2503ac0f
commit d64ea284fb
+10 -2
View File
@@ -56,9 +56,17 @@ var CPBundlesForURLStrings = { };
var bundle = CFBundle.bundleWithIdentifier(anIdentifier);
if (bundle)
bundle = CPBundlesForURLStrings[bundle.bundleURL().absoluteString()] || nil;
{
var url = bundle.bundleURL(),
cpBundle = CPBundlesForURLStrings[url.absoluteString()];
return bundle;
if (!cpBundle)
cpBundle = [self bundleWithURL:url];
return cpBundle;
}
return nil;
}
+ (CPBundle)bundleForClass:(Class)aClass