mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Support for flattened directory structure
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4073 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d1a3e9b9a7
commit
05286efbe9
2 changed files with 50 additions and 18 deletions
|
@ -1,5 +1,11 @@
|
|||
Tue Apr 13 21:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Tue Apr 13 22:05:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSBundle.m: Updated to use Info.plist if Info-gnustep.plist
|
||||
is not available. Also updated to look in alternative directories
|
||||
for the object file to load... If not in the machine/os/lib-combo
|
||||
subdirectory, tries the machine/os directory and then the top-level
|
||||
directory. Also updated to cope with the case where the NSExecutable
|
||||
entry of the Info.plist specifies a path rather than a simple file name.
|
||||
* Source/NSUser.m: Implemented NSFullUserName()
|
||||
|
||||
Mon Apr 12 13:15:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
@ -125,23 +126,42 @@ objc_executable_location( void )
|
|||
static NSString *
|
||||
bundle_object_name(NSString *path, NSString* executable)
|
||||
{
|
||||
NSString *name, *subpath;
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSString *name, *path0, *path1, *path2;
|
||||
|
||||
if (executable)
|
||||
{
|
||||
subpath = [path stringByAppendingPathComponent: gnustep_target_dir];
|
||||
subpath = [subpath stringByAppendingPathComponent: library_combo];
|
||||
name = [subpath stringByAppendingPathComponent: executable];
|
||||
}
|
||||
else
|
||||
{
|
||||
name = [[path lastPathComponent] stringByDeletingPathExtension];
|
||||
subpath = [path stringByAppendingPathComponent: gnustep_target_dir];
|
||||
subpath = [subpath stringByAppendingPathComponent: library_combo];
|
||||
name = [subpath stringByAppendingPathComponent:name];
|
||||
}
|
||||
return name;
|
||||
}
|
||||
if (executable)
|
||||
{
|
||||
NSString *exepath;
|
||||
|
||||
name = [executable lastPathComponent];
|
||||
exepath = [executable stringByDeletingLastPathComponent];
|
||||
if ([exepath isEqualToString: @""] == NO)
|
||||
{
|
||||
if ([exepath isAbsolutePath] == YES)
|
||||
path = exepath;
|
||||
else
|
||||
path = [path stringByAppendingPathComponent: exepath];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = [[path lastPathComponent] stringByDeletingPathExtension];
|
||||
path = [path stringByDeletingLastPathComponent];
|
||||
}
|
||||
path0 = [path stringByAppendingPathComponent: name];
|
||||
path = [path stringByAppendingPathComponent: gnustep_target_dir];
|
||||
path1 = [path stringByAppendingPathComponent: name];
|
||||
path = [path stringByAppendingPathComponent: library_combo];
|
||||
path2 = [path stringByAppendingPathComponent: executable];
|
||||
|
||||
if ([mgr isReadableFileAtPath: path2] == YES)
|
||||
return path2;
|
||||
else if ([mgr isReadableFileAtPath: path1] == YES)
|
||||
return path1;
|
||||
else if ([mgr isReadableFileAtPath: path0] == YES)
|
||||
return path0;
|
||||
return path2;
|
||||
}
|
||||
|
||||
/* Construct a path from components */
|
||||
static NSString *
|
||||
|
@ -791,7 +811,13 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
if (path)
|
||||
_infoDict = [[NSDictionary alloc] initWithContentsOfFile: path];
|
||||
else
|
||||
_infoDict = [[NSDictionary dictionary] retain];
|
||||
{
|
||||
path = [self pathForResource: @"Info" ofType: @"plist"];
|
||||
if (path)
|
||||
_infoDict = [[NSDictionary alloc] initWithContentsOfFile: path];
|
||||
else
|
||||
_infoDict = [[NSDictionary dictionary] retain];
|
||||
}
|
||||
return _infoDict;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue