Like the title says I'm in a search for a way to do to do the initial_path(). As you can see here there is no replacement: http://www.boost.org/doc/libs/1_46_0/libs/filesystem/v3/doc/deprecated.html
Asked
Active
Viewed 2,134 times
2 Answers
1
Why not just remember it yourself with some variable? Why do you need boost to take care of this? As they say in the docs, this is trivially taken care of by the user.

Assaf Lavie
- 73,079
- 34
- 148
- 203
-
OK, but how do i get the initial static global variable. With current_path? – NoSenseEtAl May 24 '11 at 10:15
-
OK, tnx. They probably removed it because it wasnt thread safe, AFAIK. – NoSenseEtAl May 24 '11 at 11:53
1
Are you looking for a way to get full path to your executable ?
Read this SO question
I think the answer is as below (thanks to Mike)
Here's code to get the full path to the executing app:
Windows:
int bytes = GetModuleFileName(NULL, pBuf, len);
if(bytes == 0)
return -1;
else
return bytes;
Linux:
char szTmp[32];
sprintf(szTmp, "/proc/%d/exe", getpid());
int bytes = MIN(readlink(szTmp, pBuf, len), len - 1);
if(bytes >= 0)
pBuf[bytes] = '\0';
return bytes;
-
Tnx, but I need a portable way, thats why i use boost [/commercial :P ] – NoSenseEtAl May 24 '11 at 11:40