From 7dfeea3f4ec045d333edc5ce764238c6ba30384a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 14 Aug 2023 10:14:51 +0400 Subject: [PATCH] Get rid of workingDirChosen variable It's set in every codepath where cWorkingDir is non-empty. --- Telegram/SourceFiles/logs.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index bb7b891d8..1838471bc 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -354,30 +354,16 @@ void start() { return; } - auto workingDirChosen = false; - - if (cAlphaVersion()) { - workingDirChosen = true; - } else { - - if (!cWorkingDir().isEmpty()) { - // This value must come from TelegramForcePortable - workingDirChosen = true; -#if (!defined Q_OS_WIN && !defined _DEBUG) || defined Q_OS_WINRT || defined OS_WIN_STORE || defined OS_MAC_STORE - } else { - cForceWorkingDir(psAppDataPath()); - workingDirChosen = true; -#endif // (!Q_OS_WIN && !_DEBUG) || Q_OS_WINRT || OS_WIN_STORE || OS_MAC_STORE - } - - } - LogsData = new LogsDataFields(); - if (!workingDirChosen) { + if (cWorkingDir().isEmpty()) { +#if (!defined Q_OS_WIN && !defined _DEBUG) || defined Q_OS_WINRT || defined OS_WIN_STORE || defined OS_MAC_STORE + cForceWorkingDir(psAppDataPath()); +#else // (!Q_OS_WIN && !_DEBUG) || Q_OS_WINRT || OS_WIN_STORE || OS_MAC_STORE cForceWorkingDir(cExeDir()); if (!LogsData->openMain()) { cForceWorkingDir(psAppDataPath()); } +#endif // (!Q_OS_WIN && !_DEBUG) || Q_OS_WINRT || OS_WIN_STORE || OS_MAC_STORE } if (launcher.validateCustomWorkingDir()) {