mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Bundle fixes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16678 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
92eeabaf60
commit
9bfcd9ce42
2 changed files with 53 additions and 34 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
* Tools/xmlparse.m: new utility to parse/validate xml, for testing
|
* Tools/xmlparse.m: new utility to parse/validate xml, for testing
|
||||||
gsdoc and new style property lists etc.
|
gsdoc and new style property lists etc.
|
||||||
|
* Source/NSBundle.m: ([+allBundles]) Make sure the main bundle is
|
||||||
|
present. Add some documentation.
|
||||||
|
|
||||||
2003-05-07 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-05-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -679,11 +679,19 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of all the bundles which do not belong to frameworks.<br />
|
||||||
|
* This always contains the main bundle.
|
||||||
|
*/
|
||||||
+ (NSArray *) allBundles
|
+ (NSArray *) allBundles
|
||||||
{
|
{
|
||||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 2];
|
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 2];
|
||||||
|
|
||||||
[load_lock lock];
|
[load_lock lock];
|
||||||
|
if (!_mainBundle)
|
||||||
|
{
|
||||||
|
[self mainBundle];
|
||||||
|
}
|
||||||
if (_bundles != 0)
|
if (_bundles != 0)
|
||||||
{
|
{
|
||||||
NSMapEnumerator enumerate;
|
NSMapEnumerator enumerate;
|
||||||
|
@ -708,6 +716,9 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing all the known bundles representing frameworks.
|
||||||
|
*/
|
||||||
+ (NSArray *) allFrameworks
|
+ (NSArray *) allFrameworks
|
||||||
{
|
{
|
||||||
NSMapEnumerator enumerate;
|
NSMapEnumerator enumerate;
|
||||||
|
@ -730,26 +741,29 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For an application, returns the main bundle of the application.
|
/**
|
||||||
For a tool, returns the main bundle associated with the tool.
|
* For an application, returns the main bundle of the application.<br />
|
||||||
|
* For a tool, returns the main bundle associated with the tool.<br />
|
||||||
For an application, the structure is as follows -
|
* <br />
|
||||||
|
* For an application, the structure is as follows -
|
||||||
The executable is Gomoku.app/ix86/linux-gnu/gnu-gnu-gnu/Gomoku
|
* <p>
|
||||||
and the main bundle directory is Gomoku.app/.
|
* The executable is Gomoku.app/ix86/linux-gnu/gnu-gnu-gnu/Gomoku
|
||||||
|
* and the main bundle directory is Gomoku.app/.
|
||||||
For a tool, the structure is as follows -
|
* </p>
|
||||||
|
* For a tool, the structure is as follows -
|
||||||
The executable is xxx/Tools/ix86/linux-gnu/gnu-gnu-gnu/Control
|
* <p>
|
||||||
and the main bundle directory is xxx/Tools/Resources/Control.
|
* The executable is xxx/Tools/ix86/linux-gnu/gnu-gnu-gnu/Control
|
||||||
|
* and the main bundle directory is xxx/Tools/Resources/Control.
|
||||||
(when the tool has not yet been installed, it's similar -
|
* </p>
|
||||||
xxx/shared_obj/ix86/linux-gnu/gnu-gnu-gnu/Control
|
* <p>(when the tool has not yet been installed, it's similar -
|
||||||
and the main bundle directory is xxx/Resources/Control).
|
* xxx/shared_obj/ix86/linux-gnu/gnu-gnu-gnu/Control
|
||||||
|
* and the main bundle directory is xxx/Resources/Control).
|
||||||
(For a flattened structure, the structure is the same without the
|
* </p>
|
||||||
ix86/linux-gnu/gnu-gnu-gnu directories). */
|
* <p>(For a flattened structure, the structure is the same without the
|
||||||
+ (NSBundle *)mainBundle
|
* ix86/linux-gnu/gnu-gnu-gnu directories).
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
+ (NSBundle *) mainBundle
|
||||||
{
|
{
|
||||||
[load_lock lock];
|
[load_lock lock];
|
||||||
if (!_mainBundle)
|
if (!_mainBundle)
|
||||||
|
@ -803,19 +817,19 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isApplication == YES)
|
if (isApplication == YES)
|
||||||
{
|
{
|
||||||
s = [path lastPathComponent];
|
s = [path lastPathComponent];
|
||||||
|
|
||||||
if ((([s hasSuffix: @".app"] == NO)
|
if ((([s hasSuffix: @".app"] == NO)
|
||||||
&& ([s hasSuffix: @".debug"] == NO)
|
&& ([s hasSuffix: @".debug"] == NO)
|
||||||
&& ([s hasSuffix: @".profile"] == NO))
|
&& ([s hasSuffix: @".profile"] == NO))
|
||||||
// GNUstep Web
|
// GNUstep Web
|
||||||
&& (([s hasSuffix: @".gswa"] == NO)
|
&& (([s hasSuffix: @".gswa"] == NO)
|
||||||
&& ([s hasSuffix: @".woa"] == NO)))
|
&& ([s hasSuffix: @".woa"] == NO)))
|
||||||
{
|
{
|
||||||
isApplication = NO;
|
isApplication = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isApplication == NO)
|
if (isApplication == NO)
|
||||||
{
|
{
|
||||||
|
@ -836,7 +850,10 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
return _mainBundle;
|
return _mainBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NB: We will not find a class if the bundle has not been loaded yet! */
|
/**
|
||||||
|
* Returns the bundle whose code contains the specified class.<br />
|
||||||
|
* NB: We will not find a class if the bundle has not been loaded yet!
|
||||||
|
*/
|
||||||
+ (NSBundle *) bundleForClass: (Class)aClass
|
+ (NSBundle *) bundleForClass: (Class)aClass
|
||||||
{
|
{
|
||||||
void* key;
|
void* key;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue