diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-06-14 17:39:51 +0300 |
---|---|---|
committer | Jose Medrano <josmed@microsoft.com> | 2022-06-14 18:57:25 +0300 |
commit | d3026c933cd361990a29cffb98864660a6d202ab (patch) | |
tree | c1dc596e25f9767581deaf178cc509d2bdb7f3c5 | |
parent | facd67f222ff326c28d2db35c9c5e1141b6a9c01 (diff) |
Fallback PropertyEditingResource in app bundle resources directory
-rw-r--r-- | Xamarin.PropertyEditing.Mac/HostResourceProvider.cs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs b/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs index 42720a8..7beea59 100644 --- a/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs +++ b/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs @@ -17,8 +17,14 @@ namespace Xamarin.PropertyEditing.Mac public HostResourceProvider () { - var containingDir = Path.GetDirectoryName (typeof (HostResourceProvider).Assembly.Location); - var bundlePath = Path.Combine (containingDir, "PropertyEditingResource.bundle"); + var bundlePath = NSBundle.MainBundle.PathForResource ("PropertyEditingResource", "bundle"); + if (!Directory.Exists (bundlePath)) + { + //if the bundle resource directory is not in place we fallback into the assembly location + var containingDir = Path.GetDirectoryName (typeof (HostResourceProvider).Assembly.Location); + bundlePath = Path.Combine (containingDir, "PropertyEditingResource.bundle"); + } + this.resourceBundle = new NSBundle (bundlePath); } |