On 4 May 2006, at 09:44, David Ayers wrote:
Richard Frith-Macdonald schrieb:
On 4 May 2006, at 09:21, David Ayers wrote:
Lloyd Dupont schrieb:
Problem is I would like to replace 'gnustep-base.dll' by a more
multiplatform constant / invocation.
One that could read 'gnustep-base.dll' on windows and
'gnustep-base.dylib' on MacOSX for example...
http://www.gnustep.org/resources/documentation/Developer/Base/
Reference/index.html
NSBundle: +bundleForLibrary:
I don't think that's what he wants ... it returns the resource bundle
for a named library.
I believe he needs the path to the library itsself, so that he
can read
the binary file for debug symbol info.
[snip]
For the running executable, I think you can use [[NSBundle
mainBundle]
executablePath].
I guess I was too terse but I would have assumed that:
[[NSBundle bundleForLibrary:@"gnustep-base"] executablePath]
would be what would give the expected result but indeed, this returns:
/usr/GNUstep/System/Library/Libraries/Resources/gnustep-base/./gnu-
gnu-gnu/gnustep-base
for me in a flattended configuration.
Should this be considered a bug?
While Adam is the expert on NSBundle, I think this looks like a
bug ... probably on a few counts:
1. I guess in a 'flattened' configuration the 'gnu-gnu-gnu' should
not be in there
2. The actual path to the library itsself is not in the resources
subdirectory
3. I would expect the library name to be at the end of the path
Now, I hope that the oddities arise because this bundle is a special
case produced by a non-standard method (bundleForLibrary which does
not exist in OpenStep/MacOS-X). While special case code could be
considered a feature rather than a bug, I think it's behavior should
be consistent with that of other bundles! I would have thought it
should return the path of the library.
I am not sure what the behavior of a flattened configuration should
be in general.
At present, some behavior (NSPathUtilities) seems to be controlled by
GNUSTEP_FLATTENED when the base library is configured, and hard coded
in, but other behavior (NSBundle/NSTask) ignores it and just tries to
find the best files available ... ie looks for files in the
unflattened structure and uses them in pre3ference to versions in the
flatttened structure.
Probably GNUSTEP_FLATTENED should be in the config file
(GNUstep.conf) so that it can be varied rather than being hard coded
in NSPathUtilities.
Should NSBundle/NSTask ignore stuff in the unflatttened hierarchy if
running in flattened mode, or continue to use it as the preferred
version?
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep