   Boost and path to the app dir?
  I am trying to find the path to the app under OSX with boost. I this so farpath my_path( "some_dir/file.txt" );but that assumes I know that path. I need to find the path to the file correct? SO how does one do that?Thanks   
  Is boost::filesystem::current_path() what you're looking for?   ;  Yeah I think that will work!Thanks   ;  I'd suggest examining the command line instead. The first parameter on the command line ( argv[0] ) should be the path to the program.At least under Windows this can be different to the current working directory.   ;Quote:Original post by Adam_42I'd suggest examining the command line instead. The first parameter on the command line ( argv[0] ) should be the path to the program.At least under Windows this can be different to the current working directory.This is a better idea...however I think the argv[0] is actually what was used to invoke the process?  So you could end up just having the executable name, if the current directory==executable directory, or if the executable directory is part of the PATH env variable and the user just typed c:\>MyExecutable.exe for example.  Does anyone know if it's ever possible for this to not even contain the filename, for example if the process was spawned from another?I think what you really want is a boost::filesystem (read cross platform) version of the Win32 function GetModuleFilename.  Looking in the boost docs it doesn't look like there is anything that fits the bill...Perhaps you could look at the OSX api and see if there is something similar?  If you are aiming for total cross platform, then I'm afraid I don't know of anything, but you could perhaps implement your own cross platform abstraction.   ;  According to my experience with Linux and Windows the argv[0] only has what the user gave to it in the command line.So it is pretty much useless if you want to know the full path to the executable.I do not know OSX but I would be surprised if the behaviour is that much different there.   ;  In Cocoa you would obtain the path with [[NSBundle mainBundle] bundlePath]. You can use Objective-C++ to access Cocoa from a C++ application, so that might be your best bet.   ;  That's funny, I asked pretty much this same question on StackOverflow the other day. Here's a link with some useful information. The short of it is that there's no cross-platform way to do it, which frankly sounds ridiculous to me!http://stackoverflow.com/questions/1528298/get-path-of-executable   ;Quote:Original post by hymermanThat's funny, I asked pretty much this same question on StackOverflow the other day. Here's a link with some useful information. The short of it is that there's no cross-platform way to do it, which frankly sounds ridiculous to me!http://stackoverflow.com/questions/1528298/get-path-of-executableI went back and forth over this with SiCrane a few months back. IIRC, the upshot is that most platforms give you a path in argv[0] which is sufficient to exec() the current process.There are unfortunately two problems with this: a) even when you get a working path, it tends to be relative to the PATH environment variable, and b) cygwin only hands you the executable name, no matter what you do.   ;  Sigh, issues with coding x platform and no good way to do it... I will take a look at maybe doing a preprocessor #ifdef statement or something to setup the system I am coding for and use the local API I guess. I was hoping BOOST would help since its supposed to be a C++ coders dream toolbox from what I hear. Anyway thanks all for the info.