Don't lose -freetype argument on restart

This commit is contained in:
Ilya Fedin 2020-05-20 04:10:21 +04:00 committed by John Preston
parent 7351641034
commit cd81fc6727
4 changed files with 12 additions and 2 deletions

View File

@ -90,7 +90,7 @@ int main(int argc, const char * argv[]) {
openLog(); openLog();
pid_t procId = 0; pid_t procId = 0;
BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, externalUpdater = NO; BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, freeType = NO, externalUpdater = NO;
BOOL customWorkingDir = NO; BOOL customWorkingDir = NO;
NSString *key = nil; NSString *key = nil;
for (int i = 0; i < argc; ++i) { for (int i = 0; i < argc; ++i) {
@ -116,6 +116,8 @@ int main(int argc, const char * argv[]) {
startInTray = YES; startInTray = YES;
} else if ([@"-testmode" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { } else if ([@"-testmode" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
testMode = YES; testMode = YES;
} else if ([@"-freetype" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
freeType = YES;
} else if ([@"-externalupdater" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { } else if ([@"-externalupdater" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
externalUpdater = YES; externalUpdater = YES;
} else if ([@"-workdir_custom" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { } else if ([@"-workdir_custom" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
@ -255,6 +257,7 @@ int main(int argc, const char * argv[]) {
if (_debug) [args addObject:@"-debug"]; if (_debug) [args addObject:@"-debug"];
if (startInTray) [args addObject:@"-startintray"]; if (startInTray) [args addObject:@"-startintray"];
if (testMode) [args addObject:@"-testmode"]; if (testMode) [args addObject:@"-testmode"];
if (freeType) [args addObject:@"-freetype"];
if (externalUpdater) [args addObject:@"-externalupdater"]; if (externalUpdater) [args addObject:@"-externalupdater"];
if (autoStart) [args addObject:@"-autostart"]; if (autoStart) [args addObject:@"-autostart"];
if (key) { if (key) {

View File

@ -339,7 +339,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
LPWSTR *args; LPWSTR *args;
int argsCount; int argsCount;
bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, externalupdater = false; bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, freetype = false, externalupdater = false;
args = CommandLineToArgvW(GetCommandLine(), &argsCount); args = CommandLineToArgvW(GetCommandLine(), &argsCount);
if (args) { if (args) {
for (int i = 1; i < argsCount; ++i) { for (int i = 1; i < argsCount; ++i) {
@ -355,6 +355,8 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
startintray = true; startintray = true;
} else if (equal(args[i], L"-testmode")) { } else if (equal(args[i], L"-testmode")) {
testmode = true; testmode = true;
} else if (equal(args[i], L"-freetype")) {
freetype = true;
} else if (equal(args[i], L"-externalupdater")) { } else if (equal(args[i], L"-externalupdater")) {
externalupdater = true; externalupdater = true;
} else if (equal(args[i], L"-writeprotected") && ++i < argsCount) { } else if (equal(args[i], L"-writeprotected") && ++i < argsCount) {
@ -427,6 +429,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
if (debug) targs += L" -debug"; if (debug) targs += L" -debug";
if (startintray) targs += L" -startintray"; if (startintray) targs += L" -startintray";
if (testmode) targs += L" -testmode"; if (testmode) targs += L" -testmode";
if (freetype) targs += L" -freetype";
if (externalupdater) targs += L" -externalupdater"; if (externalupdater) targs += L" -externalupdater";
if (!customWorkingDir.empty()) { if (!customWorkingDir.empty()) {
targs += L" -workdir \"" + customWorkingDir + L"\""; targs += L" -workdir \"" + customWorkingDir + L"\"";

View File

@ -64,6 +64,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
if (Logs::DebugEnabled()) [args addObject:@"-debug"]; if (Logs::DebugEnabled()) [args addObject:@"-debug"];
if (cStartInTray()) [args addObject:@"-startintray"]; if (cStartInTray()) [args addObject:@"-startintray"];
if (cTestMode()) [args addObject:@"-testmode"]; if (cTestMode()) [args addObject:@"-testmode"];
if (cUseFreeType()) [args addObject:@"-freetype"];
#ifndef TDESKTOP_DISABLE_AUTOUPDATE #ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (Core::UpdaterDisabled()) [args addObject:@"-externalupdater"]; if (Core::UpdaterDisabled()) [args addObject:@"-externalupdater"];
#endif // !TDESKTOP_DISABLE_AUTOUPDATE #endif // !TDESKTOP_DISABLE_AUTOUPDATE

View File

@ -71,6 +71,9 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
if (cTestMode()) { if (cTestMode()) {
pushArgument(qsl("-testmode")); pushArgument(qsl("-testmode"));
} }
if (cUseFreeType()) {
pushArgument(qsl("-freetype"));
}
#ifndef TDESKTOP_DISABLE_AUTOUPDATE #ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (Core::UpdaterDisabled()) { if (Core::UpdaterDisabled()) {
pushArgument(qsl("-externalupdater")); pushArgument(qsl("-externalupdater"));