o added -urlForResourceNamed:forLanguages:

o added ivars: _wrapperName,_projectName, _urlsCache,_absolutePathesCache;
o build _wrapperName in init (will avoid recreation each call of -wrapperName)
o build _projectName in init (will avoid recreation each call of -projectName)
o rename methis ...forLangue.. to ...language to be coherent


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18111 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mguesdon 2003-11-23 17:59:49 +00:00
parent 63f981626d
commit e3f1088205
2 changed files with 228 additions and 61 deletions

View file

@ -39,7 +39,12 @@
@interface GSWDeployedBundle : NSObject @interface GSWDeployedBundle : NSObject
{ {
NSString* _bundlePath; NSString* _bundlePath;
NSString* _wrapperName;
NSString* _projectName;
BOOL _isFramework;
GSWMultiKeyDictionary* _relativePathsCache; GSWMultiKeyDictionary* _relativePathsCache;
NSMutableDictionary* _absolutePathsCache;
NSMutableDictionary* _urlsCache;
NSRecursiveLock* _selfLock; NSRecursiveLock* _selfLock;
#ifndef NDEBUG #ifndef NDEBUG
int _selfLockn; int _selfLockn;
@ -48,33 +53,50 @@
#endif #endif
}; };
-(void)dealloc;
-(NSString*)description;
-(id)initWithPath:(NSString*)aPath; -(id)initWithPath:(NSString*)aPath;
-(GSWProjectBundle*)projectBundle; -(GSWProjectBundle*)projectBundle;
-(BOOL)isFramework; -(BOOL)isFramework;
-(NSString*)wrapperName; -(NSString*)wrapperName;
-(NSString*)projectName; -(NSString*)projectName;
-(NSString*)bundlePath; -(NSString*)bundlePath;
-(NSString*)bundleURLPrefix;
-(NSArray*)pathsForResourcesOfType:(NSString*)aType; -(NSArray*)pathsForResourcesOfType:(NSString*)aType;
-(NSArray*)lockedPathsForResourcesOfType:(NSString*)aType; -(NSArray*)lockedPathsForResourcesOfType:(NSString*)aType;
-(NSString*)relativePathForResourceNamed:(NSString*)aName -(NSString*)relativePathForResourceNamed:(NSString*)aName
forLanguage:(NSString*)aLanguage; language:(NSString*)aLanguage;
-(NSString*)relativePathForResourceNamed:(NSString*)aName -(NSString*)relativePathForResourceNamed:(NSString*)aName
forLanguages:(NSArray*)someLanguages; languages:(NSArray*)someLanguages;
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
forLanguage:(NSString*)aLanguage; language:(NSString*)aLanguage;
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
forLanguages:(NSArray*)someLanguages; languages:(NSArray*)someLanguages;
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
inDirectory:(NSString*)aDirectory inDirectory:(NSString*)aDirectory
forLanguages:(NSArray*)someLanguages; languages:(NSArray*)someLanguages;
-(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)aName
inDirectory:(NSString*)aDirectory inDirectory:(NSString*)aDirectory
forLanguage:(NSString*)aLanguage; language:(NSString*)aLanguage;
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
inDirectory:(NSString*)aDirectory inDirectory:(NSString*)aDirectory
forLanguage:(NSString*)aLanguage; language:(NSString*)aLanguage;
/** Returns url for resource named aName for languages someLanguages **/
-(NSString*)urlForResourceNamed:(NSString*)aName
languages:(NSArray*)someLanguages;
/** Returns the url (cached or not) for relativePath. Put it in the cache
if it was not cached **/
-(NSString*)lockedCachedURLForRelativePath:(NSString*)relativePath;
/** Returns the absolute path (cached or not) for relativePath. Put it in the cache
if it was not cached **/
-(NSString*)lockedCachedAbsolutePathForRelativePath:(NSString*)relativePath;
-(NSString*)absolutePathForRelativePath:(NSString*)relativePath;
-(NSString*)absolutePathForResourceNamed:(NSString*)aName
languages:(NSArray*)someLanguages;
-(void)lock; -(void)lock;
-(void)unlock; -(void)unlock;

View file

@ -45,22 +45,25 @@ RCS_ID("$Id$")
if ((self=[super init])) if ((self=[super init]))
{ {
NSDebugMLLog(@"bundles",@"aPath=%@",aPath); NSDebugMLLog(@"bundles",@"aPath=%@",aPath);
ASSIGN(_bundlePath,[aPath stringGoodPath]); ASSIGN(_bundlePath,[aPath stringGoodPath]);
NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath); NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath);
ASSIGN(_wrapperName,([_bundlePath lastPathComponent]));
NSDebugMLLog(@"bundles",@"_wrapperName=%@",_wrapperName);
ASSIGN(_projectName,([_wrapperName stringByDeletingPathExtension]));
NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName);
_isFramework=[_bundlePath hasSuffix:GSFrameworkSuffix];//Ok ?
_relativePathsCache=[GSWMultiKeyDictionary new]; _relativePathsCache=[GSWMultiKeyDictionary new];
_absolutePathsCache=[NSMutableDictionary new];
_urlsCache=[NSMutableDictionary new];
#ifndef NDEBUG #ifndef NDEBUG
_creation_thread_id=objc_thread_id(); _creation_thread_id=objc_thread_id();
#endif #endif
_selfLock=[NSRecursiveLock new]; _selfLock=[NSRecursiveLock new];
/*
NSDebugMLog(@"selfLock->mutex=%p",(void*)selfLock->mutex);
NSDebugMLog(@"selfLock->mutex backend=%p",(void*)((pthread_mutex_t*)(selfLock->mutex->backend)));
NSDebugMLog(@"selfLock->mutex backend m_owner=%p",
(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_owner));
NSDebugMLog(@"selfLock->mutex backend m_count=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_count));
NSDebugMLog(@"selfLock->mutex backend m_kind=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_kind));
NSDebugMLog(@"selfLock->mutex backend m_spinlock=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_spinlock));
*/
}; };
LOGObjectFnStop(); LOGObjectFnStop();
return self; return self;
@ -71,7 +74,11 @@ RCS_ID("$Id$")
{ {
NSDebugFLog(@"Dealloc GSWDeployedBundle %p",(void*)self); NSDebugFLog(@"Dealloc GSWDeployedBundle %p",(void*)self);
DESTROY(_bundlePath); DESTROY(_bundlePath);
DESTROY(_wrapperName);
DESTROY(_projectName);
DESTROY(_relativePathsCache); DESTROY(_relativePathsCache);
DESTROY(_absolutePathsCache);
DESTROY(_urlsCache);
GSWLogC("Dealloc GSWDeployedBundle: selfLock"); GSWLogC("Dealloc GSWDeployedBundle: selfLock");
NSDebugFLog(@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p creation_thread_id=%p", NSDebugFLog(@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p creation_thread_id=%p",
(void*)_selfLock, (void*)_selfLock,
@ -126,43 +133,23 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(BOOL)isFramework -(BOOL)isFramework
{ {
//OK ?? return _isFramework;
return [_bundlePath hasSuffix:GSFrameworkSuffix];
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)wrapperName -(NSString*)wrapperName
{ {
//OK ?
NSString* projectName=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath);
projectName=[_bundlePath lastPathComponent];
NSDebugMLLog(@"bundles",@"projectName=%@",projectName);
projectName=[projectName stringByDeletingPathExtension];
NSDebugMLLog(@"bundles",@"projectName=%@",projectName);
LOGObjectFnStop(); LOGObjectFnStop();
return projectName; return _wrapperName;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)projectName -(NSString*)projectName
{ {
// H:\Wotests\ObjCTest3\ObjCTest3.gswa ==> ObjCTest3
//OK ?
NSString* projectName=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"bundles",@"_gnustep_target_cpu=%@",[NSBundle _gnustep_target_cpu]);
NSDebugMLLog(@"bundles",@"_gnustep_target_dir=%@",[NSBundle _gnustep_target_dir]);
NSDebugMLLog(@"bundles",@"_gnustep_target_os=%@",[NSBundle _gnustep_target_os]);
NSDebugMLLog(@"bundles",@"_library_combo=%@",[NSBundle _library_combo]);
NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath);
projectName=[_bundlePath lastPathComponent];
NSDebugMLLog(@"bundles",@"projectName=%@",projectName);
projectName=[projectName stringByDeletingPathExtension];
NSDebugMLLog(@"bundles",@"projectName=%@",projectName);
LOGObjectFnStop(); LOGObjectFnStop();
return projectName; return _projectName;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -171,6 +158,32 @@ RCS_ID("$Id$")
return _bundlePath; return _bundlePath;
}; };
//--------------------------------------------------------------------
-(NSString*)bundleURLPrefix
{
NSString* urlPrefix=nil;
NSString* wrapperName=nil;
if ([self isFramework]) // get framework prefix ?
urlPrefix = [GSWApplication frameworksBaseURL];
else
urlPrefix = [GSWApplication applicationBaseURL];
NSDebugMLLog(@"bundles",@"urlPrefix=%@",urlPrefix);
NSAssert([urlPrefix length]>0,@"No urlPrefix");
wrapperName=[self wrapperName];
NSDebugMLLog(@"bundles",@"wrapperName=%@",wrapperName);
NSAssert([wrapperName length]>0,@"No wrapperName");
if (urlPrefix && wrapperName)
{
urlPrefix=[urlPrefix stringByAppendingPathComponent:wrapperName];
NSDebugMLLog(@"bundles",@"urlPrefix=%@",urlPrefix);
};
return urlPrefix;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSArray*)pathsForResourcesOfType:(NSString*)aType -(NSArray*)pathsForResourcesOfType:(NSString*)aType
{ {
@ -206,7 +219,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)relativePathForResourceNamed:(NSString*)aName -(NSString*)relativePathForResourceNamed:(NSString*)aName
forLanguage:(NSString*)aLanguage language:(NSString*)aLanguage
{ {
//OK //OK
NSString* path=nil; NSString* path=nil;
@ -216,7 +229,7 @@ RCS_ID("$Id$")
NS_DURING NS_DURING
{ {
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
forLanguage:aLanguage]; language:aLanguage];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
} }
NS_HANDLER NS_HANDLER
@ -234,7 +247,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)relativePathForResourceNamed:(NSString*)aName -(NSString*)relativePathForResourceNamed:(NSString*)aName
forLanguages:(NSArray*)someLanguages languages:(NSArray*)someLanguages
{ {
NSString* path=nil; NSString* path=nil;
LOGObjectFnStart(); LOGObjectFnStart();
@ -243,7 +256,7 @@ RCS_ID("$Id$")
NS_DURING NS_DURING
{ {
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
forLanguages:someLanguages]; languages:someLanguages];
//NSDebugMLLog(@"bundles",@"path=%@",path); //NSDebugMLLog(@"bundles",@"path=%@",path);
} }
NS_HANDLER NS_HANDLER
@ -262,7 +275,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
forLanguage:(NSString*)aLanguage language:(NSString*)aLanguage
{ {
//OK //OK
NSString* path=nil; NSString* path=nil;
@ -271,21 +284,21 @@ RCS_ID("$Id$")
NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",_bundlePath); NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",_bundlePath);
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
inDirectory:@"Resources/WebServer" inDirectory:@"Resources/WebServer"
forLanguage:aLanguage]; language:aLanguage];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
if (!path) if (!path)
{ {
NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",_bundlePath); NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",_bundlePath);
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
inDirectory:@"Resources" inDirectory:@"Resources"
forLanguage:aLanguage]; language:aLanguage];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
if (!path) if (!path)
{ {
NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",_bundlePath); NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",_bundlePath);
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
inDirectory:@"." inDirectory:@"."
forLanguage:aLanguage]; language:aLanguage];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
}; };
}; };
@ -295,7 +308,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
forLanguages:(NSArray*)someLanguages languages:(NSArray*)someLanguages
{ {
//OK //OK
NSString* path=nil; NSString* path=nil;
@ -304,21 +317,21 @@ RCS_ID("$Id$")
NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",_bundlePath); NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",_bundlePath);
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
inDirectory:@"Resources/WebServer" inDirectory:@"Resources/WebServer"
forLanguages:someLanguages]; languages:someLanguages];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
if (!path) if (!path)
{ {
NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",_bundlePath); NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",_bundlePath);
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
inDirectory:@"Resources" inDirectory:@"Resources"
forLanguages:someLanguages]; languages:someLanguages];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
if (!path) if (!path)
{ {
NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",_bundlePath); NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",_bundlePath);
path=[self lockedRelativePathForResourceNamed:aName path=[self lockedRelativePathForResourceNamed:aName
inDirectory:@"." inDirectory:@"."
forLanguages:someLanguages]; languages:someLanguages];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
}; };
}; };
@ -329,7 +342,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
inDirectory:(id)aDirectory inDirectory:(id)aDirectory
forLanguages:(NSArray*)someLanguages languages:(NSArray*)someLanguages
{ {
//OK //OK
NSString* path=nil; NSString* path=nil;
@ -342,14 +355,14 @@ RCS_ID("$Id$")
{ {
path=[self lockedCachedRelativePathForResourceNamed:aName path=[self lockedCachedRelativePathForResourceNamed:aName
inDirectory:aDirectory inDirectory:aDirectory
forLanguage:[someLanguages objectAtIndex:i]]; language:[someLanguages objectAtIndex:i]];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
}; };
}; };
if (!path) if (!path)
path=[self lockedCachedRelativePathForResourceNamed:aName path=[self lockedCachedRelativePathForResourceNamed:aName
inDirectory:aDirectory inDirectory:aDirectory
forLanguage:nil]; language:nil];
NSDebugMLLog(@"bundles",@"path=%@",path); NSDebugMLLog(@"bundles",@"path=%@",path);
LOGObjectFnStop(); LOGObjectFnStop();
return path; return path;
@ -358,7 +371,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)aName
inDirectory:(NSString*)aDirectory inDirectory:(NSString*)aDirectory
forLanguage:(NSString*)aLanguage language:(NSString*)aLanguage
{ {
//OK //OK
NSString* path=nil; NSString* path=nil;
@ -392,7 +405,7 @@ RCS_ID("$Id$")
path=nil; path=nil;
else if (!path) else if (!path)
{ {
//call again _relativePathForResourceNamed:inDirectory:forLanguage: //call again _relativePathForResourceNamed:inDirectory:language:
NSString* completePathTest=nil; NSString* completePathTest=nil;
BOOL exists=NO; BOOL exists=NO;
NSFileManager* fileManager=nil; NSFileManager* fileManager=nil;
@ -425,7 +438,7 @@ RCS_ID("$Id$")
NS_HANDLER NS_HANDLER
{ {
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"lockedCachedRelativePathForResourceNamed:inDirectory:forLanguage:"); @"lockedCachedRelativePathForResourceNamed:inDirectory:language:");
LOGException(@"%@ (%@)",localException,[localException reason]); LOGException(@"%@ (%@)",localException,[localException reason]);
RETAIN(localException); RETAIN(localException);
DESTROY(arp); DESTROY(arp);
@ -445,7 +458,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName -(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName
inDirectory:(NSString*)aDirectory inDirectory:(NSString*)aDirectory
forLanguage:(NSString*)aLanguage language:(NSString*)aLanguage
{ {
//OK //OK
NSString* path=nil; NSString* path=nil;
@ -454,11 +467,143 @@ RCS_ID("$Id$")
aName,aDirectory,aLanguage); aName,aDirectory,aLanguage);
path=[self lockedCachedRelativePathForResourceNamed:aName path=[self lockedCachedRelativePathForResourceNamed:aName
inDirectory:aDirectory inDirectory:aDirectory
forLanguage:aLanguage]; language:aLanguage];
LOGObjectFnStop(); LOGObjectFnStop();
return path; return path;
}; };
//--------------------------------------------------------------------
/** Returns url for resource anmed aName for languages someLanguages **/
-(NSString*)urlForResourceNamed:(NSString*)aName
languages:(NSArray*)someLanguages
{
NSString* url=nil;
LOGObjectFnStart();
NSDebugMLLog(@"bundles",@"aName=%@ someLanguages=%@",aName,someLanguages);
[self lock];
NS_DURING
{
NSString* relativePath=[self lockedRelativePathForResourceNamed:aName
languages:someLanguages];
NSDebugMLLog(@"bundles",@"relativePath=%@",relativePath);
url=[self lockedCachedURLForRelativePath:relativePath];
NSDebugMLLog(@"bundles",@"url=%@",url);
}
NS_HANDLER
{
NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)",
localException,[localException reason]);
//TODO
[self unlock];
[localException raise];
};
NS_ENDHANDLER;
[self unlock];
LOGObjectFnStop();
return url;
};
/** Returns the absolute path (cached or not) for relativePath. Put it in the cache
if it was not cached **/
-(NSString*)lockedCachedAbsolutePathForRelativePath:(NSString*)relativePath
{
NSString* path=nil;
LOGObjectFnStart();
if (relativePath)
{
// Test if already cached
path = [_absolutePathsCache objectForKey:relativePath];
// If not, build it
if (!path)
{
path=[[self bundlePath] stringByAppendingPathComponent:relativePath];
[_absolutePathsCache setObject:path
forKey:relativePath];
}
}
LOGObjectFnStop();
return path;
};
//--------------------------------------------------------------------
-(NSString*)absolutePathForRelativePath:(NSString*)relativePath
{
NSString* path=nil;
LOGObjectFnStart();
[self lock];
NS_DURING
{
path=[self lockedCachedAbsolutePathForRelativePath:relativePath];
NSDebugMLLog(@"bundles",@"path=%@",path);
}
NS_HANDLER
{
NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)",
localException,[localException reason]);
//TODO
[self unlock];
[localException raise];
};
NS_ENDHANDLER;
[self unlock];
LOGObjectFnStop();
return path;
}
//--------------------------------------------------------------------
-(NSString*)absolutePathForResourceNamed:(NSString*)aName
languages:(NSArray*)someLanguages
{
NSString* relativePath = [self relativePathForResourceNamed:aName
languages:someLanguages];
return [self absolutePathForRelativePath:relativePath];
}
//--------------------------------------------------------------------
/** Returns the url (cached or not) for relativePath. Put it in the cache
if it was not cached **/
-(NSString*)lockedCachedURLForRelativePath:(NSString*)relativePath
{
NSString* url=nil;
LOGObjectFnStart();
if (relativePath)
{
// Test if already cached
url = [_urlsCache objectForKey:relativePath];
// If not, build it
if (!url)
{
NSString* urlPrefix=[self bundleURLPrefix];
NSDebugMLLog(@"bundles",@"urlPrefix=%@",urlPrefix);
url=[urlPrefix stringByAppendingPathComponent:relativePath];
NSDebugMLLog(@"bundles",@"url=%@",url);
[_urlsCache setObject:url
forKey:relativePath];
};
}
LOGObjectFnStop();
return url;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// lock // lock
-(void)lock -(void)lock