2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 23:25:15 +00:00

Support non-standard binary names in autoupdater.

On Linux and Windows support non-standard application binary name.
This commit is contained in:
John Preston
2017-05-30 21:26:53 +03:00
parent ab3f9fbea2
commit 983c2c0869
4 changed files with 80 additions and 32 deletions

View File

@@ -541,8 +541,21 @@ bool _execUpdater(bool update = true, const QString &crashreport = QString()) {
QByteArray data(QFile::encodeName(cExeDir() + (update ? "Updater" : gExeName)));
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", p_path[] = "-workpath", p_startintray[] = "-startintray", p_testmode[] = "-testmode", p_crashreport[] = "-crashreport";
char p_datafile[MaxLen] = {0}, p_pathbuf[MaxLen] = {0}, p_crashreportbuf[MaxLen] = {0};
char *args[MaxArgsCount] = { 0 };
char p_noupdate[] = "-noupdate";
char p_autostart[] = "-autostart";
char p_debug[] = "-debug";
char p_tosettings[] = "-tosettings";
char p_key[] = "-key";
char p_datafile[MaxLen] = { 0 };
char p_path[] = "-workpath";
char p_pathbuf[MaxLen] = { 0 };
char p_startintray[] = "-startintray";
char p_testmode[] = "-testmode";
char p_crashreport[] = "-crashreport";
char p_crashreportbuf[MaxLen] = { 0 };
char p_exe[] = "-exename";
char p_exebuf[MaxLen] = { 0 };
int argIndex = 0;
args[argIndex++] = path;
if (!update) {
@@ -575,6 +588,12 @@ bool _execUpdater(bool update = true, const QString &crashreport = QString()) {
args[argIndex++] = p_crashreportbuf;
}
}
QByteArray exef = QFile::encodeName(cExeName());
if (exef.size() > 0 && exef.size() < MaxLen) {
memcpy(p_exebuf, exef.constData(), exef.size());
args[argIndex++] = p_exe;
args[argIndex++] = p_exebuf;
}
Logs::closeMain();
SignalHandlers::finish();