mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Consolidate MoveOldDataFiles path determinition
This commit is contained in:
parent
b35fff01b0
commit
330dfaa4d9
1 changed files with 6 additions and 9 deletions
|
@ -280,6 +280,9 @@ namespace {
|
|||
bool DebugModeEnabled = false;
|
||||
|
||||
void MoveOldDataFiles(const QString &wasDir) {
|
||||
if (wasDir.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QFile data(wasDir + "data"), dataConfig(wasDir + "data_config"), tdataConfig(wasDir + "tdata/config");
|
||||
if (data.exists() && dataConfig.exists() && !QFileInfo::exists(cWorkingDir() + "data") && !QFileInfo::exists(cWorkingDir() + "data_config")) { // move to home dir
|
||||
LOG(("Copying data to home dir '%1' from '%2'").arg(cWorkingDir(), wasDir));
|
||||
|
@ -351,7 +354,6 @@ void start() {
|
|||
return;
|
||||
}
|
||||
|
||||
auto moveOldDataFrom = QString();
|
||||
auto workingDirChosen = false;
|
||||
|
||||
if (cAlphaVersion()) {
|
||||
|
@ -371,10 +373,6 @@ void start() {
|
|||
#endif // !_DEBUG || OS_MAC_STORE
|
||||
}
|
||||
|
||||
#if !defined Q_OS_MAC && !defined _DEBUG // fix first version
|
||||
moveOldDataFrom = launcher.initialWorkingDir();
|
||||
#endif // !Q_OS_MAC && !_DEBUG
|
||||
|
||||
#elif defined Q_OS_WINRT // Q_OS_UNIX
|
||||
|
||||
cForceWorkingDir(psAppDataPath());
|
||||
|
@ -443,12 +441,11 @@ void start() {
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
if (cWorkingDir() == psAppDataPath()) { // fix old "Telegram Win (Unofficial)" version
|
||||
moveOldDataFrom = psAppDataPathOld();
|
||||
MoveOldDataFiles(psAppDataPathOld());
|
||||
}
|
||||
#elif !defined Q_OS_MAC && !defined _DEBUG // fix first version
|
||||
MoveOldDataFiles(launcher.initialWorkingDir());
|
||||
#endif
|
||||
if (!moveOldDataFrom.isEmpty()) {
|
||||
MoveOldDataFiles(moveOldDataFrom);
|
||||
}
|
||||
|
||||
if (LogsInMemory) {
|
||||
Assert(LogsInMemory != DeletedLogsInMemory);
|
||||
|
|
Loading…
Add table
Reference in a new issue