Something like this should work under linux (not handling LONG paths though...):
{
// in linux, look up the /proc/<PID>/exe link.
char spath[128];
memset(spath,0,128);
link.sprintf("/proc/%d/exe",getpid());
if (readlink(link.toUtf8().constData(),spath,128)>0) return spath;
return "";
}
QString appPath()
{
// in linux, look up the /proc/<PID>/exe link.
QString link;
char spath[128];
memset(spath,0,128);
link.sprintf("/proc/%d/exe",getpid());
if (readlink(link.toUtf8().constData(),spath,128)>0) return spath;
return "";
}
To copy to clipboard, switch view to plain text mode
Bookmarks