Added hack that should allow to load class lists of frameworks with a relative path (eg, if you have ../../MyFrameworks/ in your LD_LIBRARY_PATH you may be to load a framework with a relative path)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31037 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2010-07-26 14:08:22 +00:00
parent 37ae0eb8f1
commit ca9c384b3d
2 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,11 @@
2010-07-26 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSBundle.m ([+_addFrameworkFromClass:]): Added support
for class lists of frameworks with a relative path. If the
framework path is relative, convert it to absolute by prepending
the launch directory to it, since that must be how the dynamic
linker located the framework to load it.
2010-07-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: Change to use ([-isKindOfClass:]) in a couple

View file

@ -556,11 +556,24 @@ _find_main_bundle_for_tool(NSString *toolName)
{
NSString *pathComponent;
/* bundlePath should really be an absolute path; we
* recommend you use only absolute paths in LD_LIBRARY_PATH.
*
* If it isn't, we try to survive the situation; we assume
* it's relative to the launch directory. That's how the
* dynamic linker would have found it after all. This is
* fragile though, so please use absolute paths.
*/
if ([bundlePath isAbsolutePath] == NO)
{
bundlePath = [_launchDirectory
stringByAppendingPathComponent: bundlePath];
}
/* Dereference symlinks, and standardize path. This will
* only work properly if the original bundlePath is
* absolute. This should normally be the case if, as
* recommended, you use only absolute paths in
* LD_LIBRARY_PATH.
* absolute.
*/
bundlePath = [bundlePath stringByStandardizingPath];
@ -607,7 +620,8 @@ _find_main_bundle_for_tool(NSString *toolName)
[NSString stringWithFormat: @"%@%@", name, @".framework"]];
}
#else
/* There are no Versions on MinGW. Skip the Versions check here. */
/* There are no Versions on MinGW. So the version check is only
* done on non-MinGW. */
/* version name */
bundlePath = [bundlePath stringByDeletingLastPathComponent];
@ -686,7 +700,6 @@ _find_main_bundle_for_tool(NSString *toolName)
Class class = NSClassFromString(*fmClasses);
value = [NSValue valueWithPointer: (void*)class];
[bundle->_bundleClasses addObject: value];
fmClasses++;