On May 23, 2006, at 10:33 AM, Jean-Marc Lasgouttes wrote:
OK, I read the documentation and came up with the following patch,
which is probably partly bogus. I think this is supposed to do what we
need.
Could you try to turn it into working code?
JMarc
<autoopenmac.diff>
After playing around a bit, I get the following errors, which I don't
know enough to make sense of.
os_unix.C: In function 'bool lyx::support::os::autoOpenFile(const
std::string&, lyx::support::os::auto_open_mode)':
os_unix.C:152: error: invalid conversion from 'size_t' to 'FSRef*'
os_unix.C:152: error: initializing argument 2 of 'OSStatus
FSPathMakeRef(const UInt8*, FSRef*, Boolean*)'
os_unix.C:152: error: conversion from 'OSStatus' to non-scalar type
'FSRef' requested
os_unix.C:157: error: cannot convert 'FSRef' to 'FSRef*' for argument
'3' to 'OSStatus LSGetApplicationForItem(const FSRef*, LSRolesMask,
FSRef*, const __CFURL**)'
os_unix.C:162: error: cannot convert 'FSRef' to 'const FSRef*' in
assignment
For reference, here are lines 151-170:
FSRef fileref = FSPathMakeRef((UInt8 *) filename.c_str(),
filename.length(), NULL);
LSRolesMask role = (mode == VIEW) ? kLSRolesViewer : kLSRolesEditor;
FSRef outAppRef;
OSStatus status =
LSGetApplicationForItem(&fileref, role, outAppRef, NULL);
if (status == kLSApplicationNotFoundErr)
return false;
LSLaunchFSRefSpec inLaunchSpec;
inLaunchSpec.appRef = outAppRef;
inLaunchSpec.numDocs = 1;
inLaunchSpec.itemRefs = &fileref;
inLaunchSpec.passThruParams = NULL;
inLaunchSpec.launchFlags = kLSLaunchDefaults;
inLaunchSpec.asyncRefCon = NULL;
status = LSOpenFromRefSpec(&inLaunchSpec, NULL);
return status != kLSApplicationNotFoundErr;
Suggestions?
Bennett