I'm wondering on how the current working directory is calculated in OSX.
My executable (a plain unix executable file, not an apple bundle) is placed in the folder:
/Users/dbs/dev/learn/irrlicht/learn1/build/learn1/Debug/
I wrote a simple test case:
Code: Select all
IFileSystem* fs = device->getFileSystem();
std::cout << "workingdir:" << fs->getWorkingDirectory() << std::endl;
std::cout << "file: " << argv[0] << std::endl;
std::cout << "filedir: " << fs->getFileDir(argv[0]).c_str() << std::endl;
std::cout << "absfiledir:" << fs->getAbsolutePath(argv[0]).c_str() << std::endl;
std::cout << "absfiledir:" << fs->getAbsolutePath(fs->getFileDir(argv[0])).c_str() << std::endl;
Code: Select all
workingdir:/Users/dbs/dev/learn/irrlicht/learn1/build
file: ./learn1
filedir: .
absfiledir:/Users/dbs/dev/learn/irrlicht/learn1/build/learn1
absfiledir:/Users/dbs/dev/learn/irrlicht/learn1/build
I tried with several different dir structures (maybe the dir "Debug" was a special name...) but nothing changed.
Any idea on how to set the current working dir to the exact path where the executable is placed?
thanks!! and sorry if I asked a stupid question...
Davide