mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 04:50:47 +00:00
* Source/NSImage.m: -[NSImage initWithCoder:] an extension to
the previous change. If the URL doesn't load then try to load the image in the NSURL as a "named" image in resources so that the developer of the app has a way to provide this image. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35316 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
443783fc65
commit
9b080c87e0
2 changed files with 19 additions and 1 deletions
|
@ -1662,6 +1662,17 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
|
|||
if([rep isKindOfClass:[NSURL class]])
|
||||
{
|
||||
rep = [NSImageRep imageRepWithContentsOfURL:rep];
|
||||
|
||||
// If we are unable to resolved the URL, try to get it from the
|
||||
// resources folder.
|
||||
if(rep == nil)
|
||||
{
|
||||
NSString *fileName = [[rep absoluteString] lastPathComponent];
|
||||
NSString *path = [[NSBundle mainBundle] pathForImageResource:fileName];
|
||||
rep = [NSImageRep imageRepWithContentsOfFile:path];
|
||||
}
|
||||
|
||||
// If the representation was found, add it...
|
||||
if(rep != nil)
|
||||
{
|
||||
[self addRepresentation: rep];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue