Enclosed is a patch replacing two calls in os_unix.cpp which have been deprecated since MacOS 10.10.

Regards,
P. De Visschere
diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp
index 34cfd478a6..c98fe12a26 100644
--- a/src/support/os_unix.cpp
+++ b/src/support/os_unix.cpp
@@ -228,18 +228,28 @@ bool canAutoOpenFile(string const & ext, auto_open_mode 
const mode)
        CFStringRef cfs_ext = CFStringCreateWithBytes(kCFAllocatorDefault,
                                        (UInt8 *) ext.c_str(), ext.length(),
                                        kCFStringEncodingISOLatin1, false);
+       // Create UTI for the extension
+       CFStringRef cfs_uti = 
UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, cfs_ext, 
NULL);
        // this is what we would like to do but it seems that the
        // viewer for PDF is often quicktime...
        //LSRolesMask role = (mode == VIEW) ? kLSRolesViewer :  kLSRolesEditor;
        (void)mode;
        LSRolesMask role = kLSRolesAll;
-       FSRef outAppRef;
-       OSStatus status =
-               LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
-                                       cfs_ext, role, &outAppRef, NULL);
+       // Deprecated call starting from 10.10
+       //FSRef outAppRef;
+       //OSStatus status =
+       //      LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
+       //                              cfs_ext, role, &outAppRef, NULL);
+       CFURLRef appRef = LSCopyDefaultApplicationURLForContentType(cfs_uti, 
role, NULL);
        CFRelease(cfs_ext);
-
-       return status != kLSApplicationNotFoundErr;
+       CFRelease(cfs_uti);
+       if (!(appRef == NULL) ){
+               CFRelease(appRef);
+               return TRUE;
+       }
+       return FALSE;
+       //return status != kLSApplicationNotFoundErr;
+       
 #else
        // silence compiler warnings
        (void)ext;
@@ -265,9 +275,12 @@ bool autoOpenFile(string const & filename, auto_open_mode 
const mode,
 
        CFURLRef docURL = CFURLCreateFromFileSystemRepresentation(
                NULL, (UInt8 *) filename.c_str(), filename.size(), false);
-       CFURLRef appURL;
-       OSStatus status = LSGetApplicationForURL(docURL, role, NULL, &appURL);
-       if (status == kLSApplicationNotFoundErr)
+       CFErrorRef error;
+       CFURLRef appURL = LSCopyDefaultApplicationURLForURL(docURL, role, 
&error);
+       // Deprecated call starting from 10.10
+       //OSStatus status = LSGetApplicationForURL(docURL, role, NULL, &appURL);
+       //if (status == kLSApplicationNotFoundErr)
+       if ((appURL == NULL) && (CFErrorGetCode(error) == 
kLSApplicationNotFoundErr))
                return false;
 
        CFURLRef docURLs[] = { docURL };
@@ -296,7 +309,7 @@ bool autoOpenFile(string const & filename, auto_open_mode 
const mode,
                setEnv("BSTINPUTS", newbstinputs);
                setEnv("TEXFONTS", newtexfonts);
        }
-       status = LSOpenFromURLSpec (&launchUrlSpec, NULL);
+       OSStatus status = LSOpenFromURLSpec (&launchUrlSpec, NULL);
        CFRelease(launchItems);
        if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
                setEnv("TEXINPUTS", oldtexinputs);
@@ -304,6 +317,7 @@ bool autoOpenFile(string const & filename, auto_open_mode 
const mode,
                setEnv("BSTINPUTS", oldbstinputs);
                setEnv("TEXFONTS", oldtexfonts);
        }
+       CFRelease(appURL);
        return status == 0;
 #else
        // silence compiler warnings

Reply via email to