Performance hit for macOS sandboxed apps

Started by paewel, January 24, 2018, 09:59:17 AM

Previous topic - Next topic

paewel

I've noticed that when changing the metadata, the file is first copied in the same directory, then after it's finished, the old file is removed and the new one renamed.
This poses a problem with the sandbox environment of the new MacOS apps as I can't create a file, if the user didn't select the directory in which it can be created.
For my app, the user only selects the files that he wants the metadata to change.
I made a workaround by copying the image file to a directory I have access to, then calling exiftool to perform it's magic there, and then copying the file back to the original folder.
So instead of making two file operations(create new file, remove old one) I have to make four (move old file, create new, remove the old, move the new).
I wanted to ask if it's possible to set the temporary directory for new files, that way I could just copy the original, and have exiftool create the modified one in place of the original, which will reduce the operations to three.

If you have any other suggestions for how to improve this, please let me know :)

Thank you in advance!

Phil Harvey

Hi Paewel,

You should be able to do what you want in 2 operations.

To write to a different directory, use -o DIR.  This will involve only one write operation, and the original file will remain (unless you use -overwrite_original).  Then you can copy it back from there.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).