File tree Expand file tree Collapse file tree 1 file changed +5
-21
lines changed Expand file tree Collapse file tree 1 file changed +5
-21
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,11 @@ public bool HasSource()
62
62
public bool HasBundle => BundlePath . HasValueTrimmed ( ) || BundleName . HasValueTrimmed ( ) ;
63
63
64
64
/// <summary>
65
- /// Open bundle is using either the name of the bundle (for
66
- /// android compatibility), or the path to the bundle for Windows compatibility.
65
+ /// Open the image from the app's main bundle.
67
66
/// </summary>
68
67
internal NSImage OpenBundle ( )
69
68
{
70
- ImageData = OpenBundleFromString ( BundleName ) ?? OpenResourceFromString ( BundlePath ) ;
69
+ ImageData = OpenResourceFromString ( BundlePath ) ?? OpenResourceFromString ( BundleName ) ;
71
70
72
71
if ( ImageData == null )
73
72
{
@@ -77,28 +76,13 @@ internal NSImage OpenBundle()
77
76
return ImageData ;
78
77
}
79
78
80
- private static NSImage OpenBundleFromString ( string bundle )
81
- {
82
- if ( bundle . HasValueTrimmed ( ) )
83
- {
84
- return NSImage . ImageNamed ( bundle ) ;
85
- }
86
-
87
- return null ;
88
- }
89
-
90
79
private static NSImage OpenResourceFromString ( string name )
91
80
{
92
81
if ( name . HasValueTrimmed ( ) )
93
82
{
94
- var extension = Path . GetExtension ( name ) ;
95
- var fileName = name . Replace ( extension , string . Empty ) ;
96
-
97
- var path = NSBundle . MainBundle . PathForResource ( fileName , extension ) ;
98
-
99
- return ! string . IsNullOrEmpty ( path )
100
- ? new NSImage ( path )
101
- : null ;
83
+ var path = Path . Combine ( NSBundle . MainBundle . ResourcePath , name ) ;
84
+ if ( File . Exists ( path ) )
85
+ return new NSImage ( path ) ;
102
86
}
103
87
104
88
return null ;
You can’t perform that action at this time.
0 commit comments