predict where hex file will go

I'm trying to make a program that uses the hex file that the compiler generates.

I know where the hex file is by holding down shift during verification, but it goes into this random folder

What's the best way of finding this folder from my own custom program?

I thought of a solution, what do you think of this? grab a list of temporary folders, find ones that match via regular expression, find the one last modified

The directory always start with the phrase "buildxxxxxx". If you sort the directories by "date modified" it will always be the first one.

Just curious, what do you want to do with the hex file?