mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-24 12:11:18 +00:00
o added -cachedBundleForFrameworkNamed:
o fix in -lockedCachedBundleForFrameworkNamed: to return AppBundle if none is found o changes in -lockedCachedURLForResourceNamed:inFramework:languages: to call DeployedBundle -urlForResourceNamed:forLanguages: o changes in -lockedPathForResourceNamed:inFramework:languages: to call DeployedBundle -absolutePathResourceNamed:forLanguages: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18110 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c89ed3f2e8
commit
63f981626d
2 changed files with 75 additions and 83 deletions
|
@ -1,11 +1,17 @@
|
||||||
/* GSWResourceManager.h - GSWeb: Class GSWResourceManager
|
/** GSWResourceManager.h - <title>GSWeb: Class GSWResourceManager</title>
|
||||||
|
|
||||||
Copyright (C) 1999-2003 Free Software Foundation, Inc.
|
Copyright (C) 1999-2003 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||||
Date: Jan 1999
|
Date: Jan 1999
|
||||||
|
|
||||||
|
$Revision$
|
||||||
|
$Date$
|
||||||
|
$Id$
|
||||||
|
|
||||||
This file is part of the GNUstep Web Library.
|
This file is part of the GNUstep Web Library.
|
||||||
|
|
||||||
|
<license>
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
|
@ -19,7 +25,8 @@
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
</license>
|
||||||
|
**/
|
||||||
|
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
|
@ -130,6 +137,15 @@ extern NSDictionary* globalMime;
|
||||||
inFramework:(NSString*)frameworkName
|
inFramework:(NSString*)frameworkName
|
||||||
languages:(NSArray*)languages;
|
languages:(NSArray*)languages;
|
||||||
|
|
||||||
|
/** GSWeb specific
|
||||||
|
Returns the bundle for framework named aFrameworkName or application
|
||||||
|
bundle if none is found
|
||||||
|
**/
|
||||||
|
-(GSWDeployedBundle*)cachedBundleForFrameworkNamed:(NSString*)aFrameworkName;
|
||||||
|
|
||||||
|
/** Returns the bundle for framework named aFrameworkName or application
|
||||||
|
bundle if none is found
|
||||||
|
**/
|
||||||
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name;
|
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -699,7 +699,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
{
|
{
|
||||||
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
||||||
relativePath=[bundle relativePathForResourceNamed:resourceName
|
relativePath=[bundle relativePathForResourceNamed:resourceName
|
||||||
forLanguage:aLanguage];
|
language:aLanguage];
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
||||||
if (relativePath)
|
if (relativePath)
|
||||||
{
|
{
|
||||||
|
@ -711,7 +711,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
{
|
{
|
||||||
// NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
// NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
||||||
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
||||||
forLanguage:aLanguage];
|
language:aLanguage];
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
||||||
if (relativePath)
|
if (relativePath)
|
||||||
{
|
{
|
||||||
|
@ -809,7 +809,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
{
|
{
|
||||||
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
||||||
relativePath=[bundle relativePathForResourceNamed:resourceName
|
relativePath=[bundle relativePathForResourceNamed:resourceName
|
||||||
forLanguage:aLanguage];
|
language:aLanguage];
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
||||||
if (relativePath)
|
if (relativePath)
|
||||||
{
|
{
|
||||||
|
@ -821,7 +821,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
{
|
{
|
||||||
// NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
// NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
||||||
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
||||||
forLanguage:aLanguage];
|
language:aLanguage];
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
||||||
if (relativePath)
|
if (relativePath)
|
||||||
{
|
{
|
||||||
|
@ -932,16 +932,13 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
-(NSString*)lockedCachedURLForResourceNamed:(NSString*)resourceName
|
-(NSString*)lockedCachedURLForResourceNamed:(NSString*)resourceName
|
||||||
inFramework:(NSString*)aFrameworkName
|
inFramework:(NSString*)aFrameworkName
|
||||||
languages:(NSArray*)languages
|
languages:(NSArray*)languages
|
||||||
{
|
{
|
||||||
//OK
|
//OK
|
||||||
NSString* url=nil;
|
NSString* url=nil;
|
||||||
NSString* relativePath=nil;
|
|
||||||
GSWDeployedBundle* bundle=nil;
|
|
||||||
int i=0;
|
int i=0;
|
||||||
NSArray* frameworks=nil;
|
NSArray* frameworks=nil;
|
||||||
NSString* frameworkName=nil;
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@",resourceName,aFrameworkName,languages);
|
NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@",resourceName,aFrameworkName,languages);
|
||||||
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
|
if (!WOStrictFlag && [aFrameworkName isEqualToString:GSWFramework_all])
|
||||||
|
@ -954,49 +951,17 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
|
|
||||||
for(i=0;!url && i<[frameworks count];i++)
|
for(i=0;!url && i<[frameworks count];i++)
|
||||||
{
|
{
|
||||||
frameworkName=[frameworks objectAtIndex:i];
|
GSWDeployedBundle* bundle=nil;
|
||||||
|
NSString* frameworkName=[frameworks objectAtIndex:i];
|
||||||
if ([frameworkName length]==0)
|
if ([frameworkName length]==0)
|
||||||
frameworkName=nil;
|
frameworkName=nil;
|
||||||
if (frameworkName)
|
if (frameworkName)
|
||||||
{
|
bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName];
|
||||||
// NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName);
|
|
||||||
bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName];
|
|
||||||
if (bundle)
|
|
||||||
{
|
|
||||||
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
|
||||||
relativePath=[bundle relativePathForResourceNamed:resourceName
|
|
||||||
forLanguages:languages];
|
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
|
||||||
if (relativePath)
|
|
||||||
{
|
|
||||||
//TODOV
|
|
||||||
NSString* applicationBaseURL=[GSWApplication applicationBaseURL];
|
|
||||||
NSString* wrapperName=[bundle wrapperName];
|
|
||||||
NSDebugMLLog(@"resmanager",@"applicationBaseURL=%@",applicationBaseURL);
|
|
||||||
NSDebugMLLog(@"resmanager",@"wrapperName=%@",wrapperName);
|
|
||||||
url=[applicationBaseURL stringByAppendingPathComponent:wrapperName];
|
|
||||||
NSDebugMLLog(@"resmanager",@"url=%@",url);
|
|
||||||
url=[url stringByAppendingPathComponent:relativePath];
|
|
||||||
NSDebugMLLog(@"resmanager",@"url=%@",url);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
bundle=globalAppProjectBundle;
|
||||||
NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
if (bundle)
|
||||||
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
url=[bundle urlForResourceNamed:resourceName
|
||||||
forLanguages:languages];
|
languages:languages];
|
||||||
NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
|
||||||
if (relativePath)
|
|
||||||
{
|
|
||||||
NSString* applicationBaseURL=[GSWApplication applicationBaseURL];
|
|
||||||
NSString* wrapperName=[globalAppProjectBundle wrapperName];
|
|
||||||
NSDebugMLLog(@"resmanager",@"applicationBaseURL=%@",applicationBaseURL);
|
|
||||||
NSDebugMLLog(@"resmanager",@"wrapperName=%@",wrapperName);
|
|
||||||
url=[applicationBaseURL stringByAppendingPathComponent:wrapperName];
|
|
||||||
url=[url stringByAppendingPathComponent:relativePath];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
if (!url)
|
if (!url)
|
||||||
{
|
{
|
||||||
|
@ -1018,11 +983,8 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
languages:(NSArray*)languages
|
languages:(NSArray*)languages
|
||||||
{
|
{
|
||||||
NSString* path=nil;
|
NSString* path=nil;
|
||||||
NSString* relativePath=nil;
|
|
||||||
GSWDeployedBundle* bundle=nil;
|
|
||||||
int i=0;
|
int i=0;
|
||||||
NSArray* frameworks=nil;
|
NSArray* frameworks=nil;
|
||||||
NSString* frameworkName=nil;
|
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@",
|
NSDebugMLLog(@"resmanager",@"resourceName=%@ aFrameworkName=%@ languages=%@",
|
||||||
resourceName,aFrameworkName,languages);
|
resourceName,aFrameworkName,languages);
|
||||||
|
@ -1037,45 +999,57 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
|
|
||||||
for(i=0;!path && i<[frameworks count];i++)
|
for(i=0;!path && i<[frameworks count];i++)
|
||||||
{
|
{
|
||||||
frameworkName=[frameworks objectAtIndex:i];
|
GSWDeployedBundle* bundle=nil;
|
||||||
|
NSString* frameworkName=[frameworks objectAtIndex:i];
|
||||||
if ([frameworkName length]==0)
|
if ([frameworkName length]==0)
|
||||||
frameworkName=nil;
|
frameworkName=nil;
|
||||||
if (frameworkName)
|
if (frameworkName)
|
||||||
{
|
bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName];
|
||||||
// NSDebugMLLog(@"resmanager",@"frameworkName=%@",frameworkName);
|
|
||||||
bundle=[self lockedCachedBundleForFrameworkNamed:frameworkName];
|
|
||||||
//NSDebugMLLog(@"resmanager",@"bundle=%@",bundle);
|
|
||||||
if (bundle)
|
|
||||||
{
|
|
||||||
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
|
||||||
relativePath=[bundle relativePathForResourceNamed:resourceName
|
|
||||||
forLanguages:languages];
|
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
|
||||||
if (relativePath)
|
|
||||||
{
|
|
||||||
path=[[bundle bundlePath] stringByAppendingPathComponent:relativePath];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
bundle=globalAppProjectBundle;
|
||||||
NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
path=[bundle absolutePathForResourceNamed:resourceName
|
||||||
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
languages:languages];
|
||||||
forLanguages:languages];
|
|
||||||
NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
|
||||||
if (relativePath)
|
|
||||||
{
|
|
||||||
NSString* applicationPath=[GSWApp path];
|
|
||||||
path=[applicationPath stringByAppendingPathComponent:relativePath];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
// NSDebugMLLog(@"resmanager",@"path=%@",path);
|
// NSDebugMLLog(@"resmanager",@"path=%@",path);
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
return path;
|
return path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
/** GSWeb specific
|
||||||
|
Returns the bundle for framework named aFrameworkName or application
|
||||||
|
bundle if none is found
|
||||||
|
**/
|
||||||
|
-(GSWDeployedBundle*)cachedBundleForFrameworkNamed:(NSString*)aFrameworkName
|
||||||
|
{
|
||||||
|
GSWDeployedBundle* bundle=nil;
|
||||||
|
LOGObjectFnStart();
|
||||||
|
NSDebugMLLog(@"resmanager",@"frameworkName=%@",aFrameworkName);
|
||||||
|
[self lock];
|
||||||
|
NS_DURING
|
||||||
|
{
|
||||||
|
bundle=[self lockedCachedBundleForFrameworkNamed:aFrameworkName];
|
||||||
|
}
|
||||||
|
NS_HANDLER
|
||||||
|
{
|
||||||
|
NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",
|
||||||
|
localException,[localException reason],__FILE__,__LINE__);
|
||||||
|
//TODO
|
||||||
|
[self unlock];
|
||||||
|
[localException raise];
|
||||||
|
}
|
||||||
|
NS_ENDHANDLER;
|
||||||
|
[self unlock];
|
||||||
|
LOGObjectFnStop();
|
||||||
|
return bundle;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
Returns the bundle for framework named aFrameworkName or application
|
||||||
|
bundle if none is found
|
||||||
|
**/
|
||||||
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)resourceName
|
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)resourceName
|
||||||
{
|
{
|
||||||
//OK
|
//OK
|
||||||
|
@ -1132,6 +1106,8 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
//NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache);
|
//NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if (!bundle)
|
||||||
|
bundle=globalAppProjectBundle;
|
||||||
};
|
};
|
||||||
// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache);
|
// NSDebugMLLog(@"resmanager",@"_frameworkProjectBundlesCache=%@",_frameworkProjectBundlesCache);
|
||||||
// NSDebugMLLog(@"resmanager",@"bundle=%@",bundle);
|
// NSDebugMLLog(@"resmanager",@"bundle=%@",bundle);
|
||||||
|
@ -1306,7 +1282,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
{
|
{
|
||||||
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
// NSDebugMLLog(@"resmanager",@"found cached bundle=%@",bundle);
|
||||||
relativePath=[bundle relativePathForResourceNamed:resourceName
|
relativePath=[bundle relativePathForResourceNamed:resourceName
|
||||||
forLanguage:aLanguage];
|
language:aLanguage];
|
||||||
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
// NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
||||||
if (relativePath)
|
if (relativePath)
|
||||||
{
|
{
|
||||||
|
@ -1318,7 +1294,7 @@ NSString* localNotFoundMarker=@"NOTFOUND";
|
||||||
{
|
{
|
||||||
NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
|
||||||
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
relativePath=[globalAppProjectBundle relativePathForResourceNamed:resourceName
|
||||||
forLanguage:aLanguage];
|
language:aLanguage];
|
||||||
NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
NSDebugMLLog(@"resmanager",@"relativePath=%@",relativePath);
|
||||||
if (relativePath)
|
if (relativePath)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue