2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

fixed Updater for Linux version (working with home dir data)

This commit is contained in:
John Preston
2014-07-26 11:33:00 +04:00
parent a4e49a1f52
commit 905d3b6a85
2 changed files with 48 additions and 8 deletions

View File

@@ -923,7 +923,6 @@ bool psCheckReadyUpdate() {
return false;
}
#elif defined Q_OS_LINUX
QFileInfo to(curUpdater);
if (!moveFile(updater.absoluteFilePath().toUtf8().constData(), curUpdater.toUtf8().constData())) {
PsUpdateDownloader::clearAll();
return false;
@@ -957,8 +956,8 @@ bool _execUpdater(bool update = true) {
QByteArray data((cExeDir() + "Updater").toUtf8());
memcpy(path, data.constData(), data.size());
char *args[MaxArgsCount] = {0}, p_noupdate[] = "-noupdate", p_autostart[] = "-autostart", p_debug[] = "-debug", p_tosettings[] = "-tosettings", p_key[] = "-key";
char p_datafile[MaxLen] = {0};
char *args[MaxArgsCount] = {0}, p_noupdate[] = "-noupdate", p_autostart[] = "-autostart", p_debug[] = "-debug", p_tosettings[] = "-tosettings", p_key[] = "-key", p_path[] = "-workpath";
char p_datafile[MaxLen] = {0}, p_pathbuf[MaxLen] = {0};
int argIndex = 0;
args[argIndex++] = path;
if (!update) {
@@ -975,6 +974,12 @@ bool _execUpdater(bool update = true) {
args[argIndex++] = p_datafile;
}
}
QByteArray pathf = cWorkingDir().toLocal8Bit();
if (pathf.size() < MaxLen) {
memcpy(p_pathbuf, pathf.constData(), pathf.size());
args[argIndex++] = p_path;
args[argIndex++] = p_pathbuf;
}
pid_t pid = fork();
switch (pid) {