Main Menu

C++ Config File

Started by Kento, January 28, 2019, 02:10:09 PM

Previous topic - Next topic

Kento

Hi,

I have been trying to use the C++ interface to manipulate metadata. I created a simple config file that I am using to define some user defined properties.
I can use the config file from the terminal successfully, however when I am trying to do the same thing using C++ it gives me the following error:

Ignored -copnfig option (not first on command line)

The config option is the first option passed in so I am confused why I am getting this error

Here is the code that I have been working with:

ExifTool *et = new ExifTool();
et->Command("-config\n~/Downloads/exiftool.config\n-CustomTag=customTag\n~/Downloads/dummy.pdf");
et->Complete();

StarGeek

You may have to wait a few weeks for an accurate response to this as Phil has gone on vacation and I don't have any C++ experience.

But I think the problem has to do with the fact that the C++ interface uses the -stay_open option, as mentioned under "Interface Features" on the C++ interface page.  The -Config option cannot appear within the file used by the stay_open option.

Looking at the Constructor Method, though, seems to me to indicate the placement for the config option.  The second argument for that is "Optional first argument for application".  So, set the first argument to NULL so the default for exiftool is used and then set the second argument to -config ~/Downloads/exiftool.config.  Since this isn't part of the stay_open, I don't think it should be separated by the new line.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Kento

Thank you for your answer.
I tried what you suggested by passing the config in the constructor but unfortunately I got the following error:

Invalid TAG name: "config ~/Downloads/exiftool.config"

I have also tried to rename the config file to .ExifTool_config and placing it in the directory where the exiftool exists but this also did not work. It only works when I pass it through the command line.

Phil Harvey

You can't use the -config option with the C++ interface.  But it should work by naming it .ExifTool_config and putting it in the exiftool directory or your home directory.  I don't know why this doesn't seem to work for  you.

- 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 ($).