- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
#ifdef _WIN32
...
#elif defined __linux__
std::string path;
char buff[PATH_MAX];
ssize_t len = ::readlink("/proc/self/exe", buff, sizeof(buff)-1);
if (len != -1)
{
buff[len] = '\0';
path = buff;
}
else
{
return -1;
}
int pos = path.rfind("/");
if (pos == std::string::npos)
return - 1;
path = path.substr(0, pos + 1);
path += "updater";
std::string sys_path = path;
boost::replace_all(sys_path, " ", "\\ ");
std::string rm = "rm -f ";
rm += sys_path;
system(rm.c_str());
_data.save_2_file(core::tools::from_utf8(path));
std::string chmod = "chmod 755 ";
chmod += sys_path;
system(chmod.c_str());
system(sys_path.c_str());
#endif //_WIN32
Как правильно обновлять #mailru/icqdesktop на Linux, если вы понимаете о чём я.