Permalink
Browse files

Fix fallback search of embedded NIB.

  • Loading branch information...
1 parent 62fef8f commit 12340919e75202366437266ff875161151839d5f @letiemble letiemble committed Mar 14, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 libraries/Monobjc.AppKit/AppKit_Extensions/NSNib.Interop.cs
@@ -59,21 +59,24 @@ public static bool InstantiateNibWithOwnerTopLevelObjects (Type type, NSString r
// Check with full locale
CultureInfo cultureInfo = locale.ToCultureInfo ();
- String candidate = resources.FirstOrDefault (r => String.Equals (r, resourceName + cultureInfo.Name));
+ String key = resourceName + (String.IsNullOrEmpty (cultureInfo.Name) ? String.Empty : "." + cultureInfo.Name);
+ String candidate = resources.FirstOrDefault (r => String.Equals (r, key));
if (candidate != null) {
candidates.Add (candidate);
}
// Check with language
cultureInfo = cultureInfo.Parent;
- candidate = resources.FirstOrDefault (r => String.Equals (r, resourceName + cultureInfo.Name));
+ key = resourceName + (String.IsNullOrEmpty (cultureInfo.Name) ? String.Empty : "." + cultureInfo.Name);
+ candidate = resources.FirstOrDefault (r => String.Equals (r, key));
if (candidate != null) {
candidates.Add (candidate);
}
// Check invariant
cultureInfo = cultureInfo.Parent;
- candidate = resources.FirstOrDefault (r => String.Equals (r, resourceName + cultureInfo.Name));
+ key = resourceName + (String.IsNullOrEmpty (cultureInfo.Name) ? String.Empty : "." + cultureInfo.Name);
+ candidate = resources.FirstOrDefault (r => String.Equals (r, key));
if (candidate != null) {
candidates.Add (candidate);
}
@@ -88,7 +91,7 @@ public static bool InstantiateNibWithOwnerTopLevelObjects (Type type, NSString r
using (Stream fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write)) {
using (Stream resourceStream = assembly.GetManifestResourceStream(name)) {
- resourceStream.CopyTo(fileStream);
+ resourceStream.CopyTo (fileStream);
}
}

0 comments on commit 1234091

Please sign in to comment.