c++ - Application thinks it's in my home folder OSX -


I compile using Excel and C ++ 11 both Windows and OSX. When I create a release and drag it to another folder, then there is an existing current working directory in Windows Binary. OSX release thinks it's in my home folder. No matter where I put it, it thinks it's going on in my home directory.

I have put a print statement in my code to prove it: Current working: / user / dom

This problem occurs when I double click on the binary If I open a terminal and using the program / it opens in the appropriate directory

I'm not sure how to fix it, but it should be sure to find the application relative to the path path specific resources

Thank you!

Solution:

  Four Paths [1024]; Uint32_t size = sizeof (path); If (_NSGetExecutablePath (Path, and Size) == 0) {/.*/}  

If you are UAC-alidded, it will not work under Windows because the current directory has been reset to % WINDIR% \ system32 during the height. [On these platforms] All processes are the concept of an existing directory that does not guarantee the directory of the program. You will need to find your binary in another way, like in one of these ways:


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -