I want to use eagle in command line form to automate some tasks. I added the Eagle bin directory to my path, and I tried running the command:
D:\Developpement\boards> eaglecon -C "quit" foo.sch
But I get the following error:
argv[0] (D:/Developpement/boards/eaglecon.exe) is not the currently executed program version!
The mentioned path points to nothing, the exe file is actually at "C:\Program Files (x86)\EAGLE-6.2.0\bin\eaglecon.exe". If I type the full path of the exe in my command line, it starts properly.
I believe that Eagle is using argv[0] to locate the executable (I wonder why), but it's ignoring the Path environment variable. I understand it's very difficult to locate the executable using argv[0] (because of the PATH system, and eventual shell aliases) and I guess devs took the expeditive approach of taking it as an absolute or relative path from the current dir, but this is very annoying to use a long path every time I want to invoke Eagle from the command line.
So my suggestion would be to either [A] properly parse the Path (and Pathext on Windows) environment variable(s), or to [B] use the GetModuleFileName(NULL) win32 API call to determine the executable path. From a programmer perspective that second change is trivial.