+namespace
+{
+
+bool HasAppKit_10_6()
+{
+ // Even if we require 10.6, we might be loaded by an application that
+ // was linked against 10.5. setAllowedFileTypes will still be ignored
+ // in this case. From NSSavePanel.h:
+ // NSOpenPanel: On versions less than 10.6, this property is ignored.
+ // For applications that link against 10.6 and higher, this property will
+ // determine which files should be enabled in the open panel.
+ int32_t version = NSVersionOfLinkTimeLibrary("AppKit");
+ if (version == -1)
+ {
+ // If we're loaded by an application that doesn't link against AppKit,
+ // use the runtime version instead. This check will not work for the
+ // case above.
+ version = NSVersionOfRunTimeLibrary("AppKit");
+ }
+
+ // Notice that this still works correctly even if version is -1.
+ return version >= 0x40e2400 /* version of 10.6 AppKit */;
+}
+
+} // anonymous namespace
+