mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-06-03 10:30:46 +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* emptyString=[NSString string];
|
||||||
NSString* bundlePath=[self bundlePath];
|
NSString* bundlePath=[self bundlePath];
|
||||||
NSArray* keys;
|
NSDebugMLLog(@"bundles",@"aName=%@ bundlePath=%@ aDirectory=%@ aLanguage=%@",
|
||||||
|
aName,bundlePath,aDirectory,aLanguage);
|
||||||
if ([aDirectory isEqualToString:@"."])
|
if ([aDirectory isEqualToString:@"."])
|
||||||
aDirectory=nil;
|
aDirectory=nil;
|
||||||
if (aLanguage)
|
if (aLanguage)
|
||||||
keys=[NSArray arrayWithObjects:aName,
|
path=[_relativePathsCache objectForKeys:aName,
|
||||||
bundlePath ? bundlePath : emptyString,
|
(bundlePath ? bundlePath : emptyString),
|
||||||
aDirectory ? aDirectory : emptyString,
|
(aDirectory ? aDirectory : emptyString),
|
||||||
aLanguage ? aLanguage : emptyString,
|
(aLanguage ? aLanguage : emptyString),
|
||||||
nil];
|
nil];
|
||||||
else
|
else
|
||||||
keys=[NSArray arrayWithObjects:aName,
|
path=[_relativePathsCache objectForKeys:aName,
|
||||||
bundlePath ? bundlePath : emptyString,
|
(bundlePath ? bundlePath : emptyString),
|
||||||
aDirectory ? aDirectory : emptyString,
|
(aDirectory ? aDirectory : emptyString),
|
||||||
nil];
|
nil];
|
||||||
//NSDebugMLLog(@"bundles",@"_keys=%@",_keys);
|
NSDebugMLLog(@"bundles",@"path=%@",path);
|
||||||
path=[_relativePathsCache objectForKeysArray:keys];
|
|
||||||
//NSDebugMLLog(@"bundles",@"_path=%@",_path);
|
|
||||||
if (path==GSNotFoundMarker)
|
if (path==GSNotFoundMarker)
|
||||||
path=nil;
|
path=nil;
|
||||||
else if (!path)
|
else if (!path)
|
||||||
|
@ -427,12 +426,36 @@ RCS_ID("$Id$")
|
||||||
if (exists)
|
if (exists)
|
||||||
{
|
{
|
||||||
path=pathTest;
|
path=pathTest;
|
||||||
|
if (aLanguage)
|
||||||
[_relativePathsCache setObject:path
|
[_relativePathsCache setObject:path
|
||||||
forKeysArray:keys];
|
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
|
else
|
||||||
|
{
|
||||||
|
if (aLanguage)
|
||||||
[_relativePathsCache setObject:GSNotFoundMarker
|
[_relativePathsCache setObject:GSNotFoundMarker
|
||||||
forKeysArray:keys];
|
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
|
NS_HANDLER
|
||||||
|
@ -568,9 +591,20 @@ if it was not cached **/
|
||||||
-(NSString*)absolutePathForResourceNamed:(NSString*)aName
|
-(NSString*)absolutePathForResourceNamed:(NSString*)aName
|
||||||
languages:(NSArray*)someLanguages
|
languages:(NSArray*)someLanguages
|
||||||
{
|
{
|
||||||
NSString* relativePath = [self relativePathForResourceNamed:aName
|
NSString* absolutePath=nil;
|
||||||
|
NSString* relativePath=nil;
|
||||||
|
|
||||||
|
LOGObjectFnStart();
|
||||||
|
|
||||||
|
relativePath = [self relativePathForResourceNamed:aName
|
||||||
languages:someLanguages];
|
languages:someLanguages];
|
||||||
return [self absolutePathForRelativePath:relativePath];
|
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