Skip to content

Commit

Permalink
Get rid of workingDirChosen variable
Browse files Browse the repository at this point in the history
It's set in every codepath where cWorkingDir is non-empty.
  • Loading branch information
ilya-fedin committed Aug 14, 2023
1 parent 2428894 commit 2767fc1
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions Telegram/SourceFiles/logs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 2767fc1

Please sign in to comment.