Xcode relative path for build app

Hi everyone,
sorry if this is the wrong post or the wrong forum but I am running out of resources…
The problem that I have is with Xcode and a C++ program (I am not using OF for this).
I’ve done a very simple program and I build an executable in XCodeProject/build/products/debug
When I run the program from Xcode, the code creates a log file that is automatically saved in the project directory.
However, if I run the executable, the log file is created in my User/MyName directory.
I tried to assign a var getenv ("PWD") to get the working directory but it didn’t work. I tried to change the path but again, no luck.
I had a look at the settings in the Release Header Search Path and I tried assigning $(SRCROOT)… same result as before…
If anyone had an idea on why is this happening it would be great to know more about it!

thank you!!