On Nov 2, 2015, at 12:39 PM, Dominic Giampaolo < email@hidden> wrote:
That could work. Or you could create a CF/NSURL Bookmark to locate the document when the user tries to open it and then patch up any paths it stores before you ask your library of db code to open the db.
The problem is that the database code uses paths *while it’s running* to operate on files. For example, it creates and deletes temporary files next to the main database file. It stores the path of the database when it’s opened, and constructs the temp-file paths relative to that.
I could use various techniques to update the paths before any call I make to the library, but of course the directory could be moved in between that check and the actual filesystem call to open a temp file.
On Nov 2, 2015, at 12:25 PM, Chris Suter < email@hidden> wrote:
If you can change the third party library, look at openat.
That looks promising, although it requires 10.10. The library has a filesystem abstraction layer that I could hook this into. Presumably I’d create and open a scratch file in that directory, then use its fd as the base for openat.
I was about to ask how you _delete_ a file using this trick, but then I tried “man unlinkat” and that answers my question.
—Jens |