mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-05-31 01:01:19 +00:00
o modified use of GSWMultiKeyDictionary to avoid creation of
temporary arrays git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18351 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
305bb7fce6
commit
5ff9cd6492
1 changed files with 54 additions and 20 deletions
|
@ -384,23 +384,22 @@ RCS_ID("$Id$")
|
|||
{
|
||||
NSString* emptyString=[NSString string];
|
||||
NSString* bundlePath=[self bundlePath];
|
||||
NSArray* keys;
|
||||
NSDebugMLLog(@"bundles",@"aName=%@ bundlePath=%@ aDirectory=%@ aLanguage=%@",
|
||||
aName,bundlePath,aDirectory,aLanguage);
|
||||
if ([aDirectory isEqualToString:@"."])
|
||||
aDirectory=nil;
|
||||
if (aLanguage)
|
||||
keys=[NSArray arrayWithObjects:aName,
|
||||
bundlePath ? bundlePath : emptyString,
|
||||
aDirectory ? aDirectory : emptyString,
|
||||
aLanguage ? aLanguage : emptyString,
|
||||
nil];
|
||||
path=[_relativePathsCache objectForKeys:aName,
|
||||
(bundlePath ? bundlePath : emptyString),
|
||||
(aDirectory ? aDirectory : emptyString),
|
||||
(aLanguage ? aLanguage : emptyString),
|
||||
nil];
|
||||
else
|
||||
keys=[NSArray arrayWithObjects:aName,
|
||||
bundlePath ? bundlePath : emptyString,
|
||||
aDirectory ? aDirectory : emptyString,
|
||||
nil];
|
||||
//NSDebugMLLog(@"bundles",@"_keys=%@",_keys);
|
||||
path=[_relativePathsCache objectForKeysArray:keys];
|
||||
//NSDebugMLLog(@"bundles",@"_path=%@",_path);
|
||||
path=[_relativePathsCache objectForKeys:aName,
|
||||
(bundlePath ? bundlePath : emptyString),
|
||||
(aDirectory ? aDirectory : emptyString),
|
||||
nil];
|
||||
NSDebugMLLog(@"bundles",@"path=%@",path);
|
||||
if (path==GSNotFoundMarker)
|
||||
path=nil;
|
||||
else if (!path)
|
||||
|
@ -427,12 +426,36 @@ RCS_ID("$Id$")
|
|||
if (exists)
|
||||
{
|
||||
path=pathTest;
|
||||
[_relativePathsCache setObject:path
|
||||
forKeysArray:keys];
|
||||
if (aLanguage)
|
||||
[_relativePathsCache setObject:path
|
||||
forKeys:aName,
|
||||
(bundlePath ? bundlePath : emptyString),
|
||||
(aDirectory ? aDirectory : emptyString),
|
||||
(aLanguage ? aLanguage : emptyString),
|
||||
nil];
|
||||
else
|
||||
[_relativePathsCache setObject:path
|
||||
forKeys:aName,
|
||||
(bundlePath ? bundlePath : emptyString),
|
||||
(aDirectory ? aDirectory : emptyString),
|
||||
nil];
|
||||
}
|
||||
else
|
||||
[_relativePathsCache setObject:GSNotFoundMarker
|
||||
forKeysArray:keys];
|
||||
{
|
||||
if (aLanguage)
|
||||
[_relativePathsCache setObject:GSNotFoundMarker
|
||||
forKeys:aName,
|
||||
(bundlePath ? bundlePath : emptyString),
|
||||
(aDirectory ? aDirectory : emptyString),
|
||||
(aLanguage ? aLanguage : emptyString),
|
||||
nil];
|
||||
else
|
||||
[_relativePathsCache setObject:GSNotFoundMarker
|
||||
forKeys:aName,
|
||||
(bundlePath ? bundlePath : emptyString),
|
||||
(aDirectory ? aDirectory : emptyString),
|
||||
nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
|
@ -568,9 +591,20 @@ if it was not cached **/
|
|||
-(NSString*)absolutePathForResourceNamed:(NSString*)aName
|
||||
languages:(NSArray*)someLanguages
|
||||
{
|
||||
NSString* relativePath = [self relativePathForResourceNamed:aName
|
||||
languages:someLanguages];
|
||||
return [self absolutePathForRelativePath:relativePath];
|
||||
NSString* absolutePath=nil;
|
||||
NSString* relativePath=nil;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
relativePath = [self relativePathForResourceNamed:aName
|
||||
languages:someLanguages];
|
||||
NSDebugMLLog(@"bundles",@"relativePath=%@",relativePath);
|
||||
|
||||
absolutePath=[self absolutePathForRelativePath:relativePath];
|
||||
NSDebugMLLog(@"bundles",@"absolutePath=%@",absolutePath);
|
||||
|
||||
LOGObjectFnStop();
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue