, CoreFoundation, Foundation. CFBundle, , . , -, , , .
CoreFoundation, +[NSBundle pathForResource:ofType:inDirectory:], CFBundleCopyResourceURLInDirectory(), . ( , -pathForResource:ofType:inDirectory: .)
_ CFBundleCopyDirectoryContentsAtPath(). . , contentsCache.
: TestAppCopy.app, , TestApp.app, TestAppCopy.app. , TestAppCopy.app. TestAppCopy.app , " " :
__CFSpinLock(&CFBundleResourceGlobalDataLock);
if (contentsCache) dirDirContents = (CFArrayRef)CFDictionaryGetValue(contentsCache, dirName);
if (dirDirContents) {
Boolean foundIt = false;
CFIndex dirDirIdx, dirDirLength = CFArrayGetCount(dirDirContents);
for (dirDirIdx = 0; !foundIt && dirDirIdx < dirDirLength; dirDirIdx++) if (kCFCompareEqualTo == CFStringCompare(name, CFArrayGetValueAtIndex(dirDirContents, dirDirIdx), kCFCompareCaseInsensitive)) foundIt = true;
if (!foundIt) tryToOpen = false;
}
__CFSpinUnlock(&CFBundleResourceGlobalDataLock);
, , , . ( ) TestAppCopy.app, , . , , , en.lproj, , .
CoreFoundation SPI CFBundle. , API CoreFoundation, __CFBundleDeallocate(). , : _CFBundleFlushContentsCacheForPath(), , , , .
, , CoreFoundation TestApp.app, ( TestApp.app Contents), CFBundle , CFBundle. , , , TestAppCopy.app , TestAppCopy.app .