I am using a third-party program to build the binary file and upload it under Arduino IDE's GUI, meaning I am not using the built-in avr-gcc nor avrdude for building and uploading. As there is a on-board DAP chip, uploading binary file is done by copy&paste the binary file into the flash memory recognized as a removable storage by the OS.
However, this make reading user's current port selection very difficult because the IDE is written in Java, but the thrid-party program I am using is in C++.
Knowing which port the user has currently selected is very important to me, as sometimes I need to program multiple boards at the same time and monitor their received data on the serial port.
If someone can point me into the right direction or link me to the previously-solved similar question , it will be much appreciated!
PS: I am working under Ubuntu&Windows10 OS and using latest Arduino IDE.