Le 27 mai 07 à 00:55, Mael Hilléreau a écrit :

According to Apple's "Bundle Programming Guide",

The Finder identifies packages by any of the following mechanisms:
* The directory has a known extension: .app, .bundle, .framework, .plugin, .kext, and so on.
* The directory has its bundle bit set.
* The directory has a known structure type indicating it is a modern or versioned bundle.

As a conclusion, as it is really not easy to distinguish between folders, applications, ..., and packages corresponding to graphics (such as '.graffle' files), I would suggest to replace the function call by a different one, and to consider folders having an extension to be valid files (only for Mac OS of course...). In the case the chosen package isn't supported (i.e. it is a folder or anything else but supported graphics), LyX won't crash because the file format won't be recognized.

I think (not tested) that replacing the line 381 (in GraphicsCacheItem.C) with the following should do the job:

if (!(fs::exists(filename_) && (!fs::is_directory(filename_) || fs::extension(filename_) != "") && fs::is_readable(filename_))) {

... assuming that 'fs' is known (namespace fs = boost::filesystem;)

I made a patch which enables inserting Mac OS packages (i.e. folders) as graphics (see attached file). It works with '.graffle' packages only if you add a copier for OmniGraffle: rm -fr $$o; cp -R $$i $$o

There's a remaining problem when one edits the file: the graphic is neither updated in lyx window (until lyx is restarted...) nor in the resulting PDF (until the rest of the document is modified, e.g. some text).

Please, tell me what you think of this.

I'm still waiting for comments...

Mael.

--
Mael Hilléreau
http://mael.hillereau.free.fr

Attachment: graphics-as-macos-packages.patch
Description: Binary data



Reply via email to