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
This commit is contained in:
Scott Christley 1997-03-04 19:21:04 +00:00
parent 5fda1b1a07
commit 8ed2402f35
2 changed files with 12 additions and 10 deletions

View file

@ -23,6 +23,8 @@ Tue Mar 4 09:28:57 1997 GNUstep Development <gnustep@net-community.com>
* 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 <ovidiu@bx.logicnet.ro>

View file

@ -45,8 +45,9 @@
#include <AppKit/NSScreen.h>
#include <AppKit/NSColor.h>
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;
}