From 8ed2402f3598f29944fc224c9bc6009174749a3f Mon Sep 17 00:00:00 2001 From: Scott Christley Date: Tue, 4 Mar 1997 19:21:04 +0000 Subject: [PATCH] Fix NSImage so that it searches system resource directory properly. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2226 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 ++ Source/NSImage.m | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18197beb3..650092998 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ Tue Mar 4 09:28:57 1997 GNUstep Development * Source/NSFont.m (getFont): Return font not font name. * Images/Makefile.in: Install common_Dimple.tiff. + * Source/NSBundle.m (+imageNamed:): Create a bundle with + gnustep library install path for searching system resources. Mon Feb 17 19:30:50 1997 Ovidiu Predescu diff --git a/Source/NSImage.m b/Source/NSImage.m index adf04c6e5..d37bb6b35 100644 --- a/Source/NSImage.m +++ b/Source/NSImage.m @@ -45,8 +45,9 @@ #include #include -static NSString* NSImage_PATH - = @GNUSTEP_INSTALL_LIBDIR @"/Images"; +// Resource directories +static NSString* gnustep_libdir = @GNUSTEP_INSTALL_LIBDIR; +static NSString* NSImage_PATH = @"Images"; /* Backend protocol - methods that must be implemented by the backend to complete the class */ @@ -188,12 +189,12 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd) /* If not found then search in system */ if (!path) { - NSArray* dirsArray = [NSArray arrayWithObject:NSImage_PATH]; + NSBundle *system = [NSBundle bundleWithPath: gnustep_libdir]; if (ext) - path = [NSBundle pathForResource: aName - ofType: ext - inDirectories:dirsArray]; + path = [system pathForResource: aName + ofType: ext + inDirectory: NSImage_PATH]; else { id o, e; @@ -205,10 +206,9 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd) e = [array objectEnumerator]; while ((o = [e nextObject])) { - NSDebugLog(@"extension %s, array = %@\n", [o cString], dirsArray); - path = [NSBundle pathForResource: aName - ofType: o - inDirectories:dirsArray]; + path = [system pathForResource: aName + ofType: o + inDirectory: NSImage_PATH]; if ([path length] != 0) break; }