Fix name search so full path is returned

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6643 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2000-06-06 22:12:39 +00:00
parent 9360b6e9cc
commit d66abe4b01
5 changed files with 17 additions and 12 deletions

View file

@ -27,7 +27,9 @@
#include <base/preface.h> #include <base/preface.h>
#include <base/Port.h> #include <base/Port.h>
#include <sys/types.h> #include <sys/types.h>
#ifndef __WIN32__ #ifdef __WIN32__
# include <winsock.h>
#else
# include <sys/socket.h> # include <sys/socket.h>
# include <netinet/in.h> # include <netinet/in.h>
#endif /* !WIN32 */ #endif /* !WIN32 */

View file

@ -192,8 +192,8 @@ _bundle_name_first_match(NSString* directory, NSString* name)
filelist = [[mgr directoryContentsAtPath: directory] objectEnumerator]; filelist = [[mgr directoryContentsAtPath: directory] objectEnumerator];
while ((match = [filelist nextObject])) while ((match = [filelist nextObject]))
{ {
if ([path isEqual: [match stringByDeletingPathExtension]]) if ([name isEqual: [match stringByDeletingPathExtension]])
return match; return [directory stringByAppendingPathComponent: match];
} }
return nil; return nil;
@ -768,7 +768,7 @@ _bundle_load_callback(Class theClass, Category *theCategory)
while ((match = [filelist nextObject])) while ((match = [filelist nextObject]))
{ {
if (allfiles || [extension isEqual: [match pathExtension]]) if (allfiles || [extension isEqual: [match pathExtension]])
[resources addObject: match]; [resources addObject: [path stringByAppendingPathComponent: match]];
} }
} }

View file

@ -994,10 +994,10 @@ static NSMapTable *absolutes = 0;
+ (NSString*) getTimeZoneFile: (NSString *)name + (NSString*) getTimeZoneFile: (NSString *)name
{ {
NSString *fileName = [NSString stringWithFormat: @"%@%@", ZONES_DIR, name]; NSString *dir = [NSString stringWithFormat: @"%@/%@", TIME_ZONE_DIR, ZONES_DIR];
NSString *path = [NSBundle pathForGNUstepResource: fileName NSString *path = [NSBundle pathForGNUstepResource: name
ofType: @"" ofType: @""
inDirectory: TIME_ZONE_DIR]; inDirectory: dir];
return path; return path;
} }

View file

@ -31,7 +31,6 @@
#include <Foundation/NSLock.h> #include <Foundation/NSLock.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSHost.h> #include <Foundation/NSHost.h>
#include <unistd.h>
#if _AIX #if _AIX
#include <sys/select.h> #include <sys/select.h>
@ -40,6 +39,7 @@
#ifdef __WIN32__ #ifdef __WIN32__
#include <winsock.h> #include <winsock.h>
#else #else
#include <unistd.h>
#include <netdb.h> #include <netdb.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>

View file

@ -4,15 +4,18 @@
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <Foundation/NSDate.h> #include <Foundation/NSDate.h>
#include <Foundation/NSDictionary.h> #include <Foundation/NSDictionary.h>
#include <Foundation/NSAutoreleasePool.h>
int int
main () main ()
{ {
id detail; NSAutoreleasePool *pool = [NSAutoreleasePool new];
printf("time zones for PST:\n%@\n", NSLog(@"time zones:\n%@\n", [[NSTimeZone timeZoneArray] description]);
NSLog(@"time zones for PST:\n%@\n",
[[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description]); [[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description]);
printf("time zones:\n%@\n", [[NSTimeZone timeZoneArray] description]); NSLog(@"local time zone:\n%@\n", [[NSTimeZone localTimeZone] description]);
printf("local time zone:\n%@\n", [[NSTimeZone localTimeZone] description]);
[pool release];
return 0; return 0;
} }