Fix clearing storage_account files on logout.
This commit is contained in:
parent
ad4afe9293
commit
7892ba97e6
|
@ -1069,20 +1069,6 @@ void ClearManager::onStart() {
|
|||
switch (task) {
|
||||
case ClearManagerAll: {
|
||||
result = QDir(cTempDir()).removeRecursively();
|
||||
// #TODO
|
||||
//QDirIterator di(_userBasePath, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
|
||||
//while (di.hasNext()) {
|
||||
// di.next();
|
||||
// const QFileInfo& fi = di.fileInfo();
|
||||
// if (fi.isDir() && !fi.isSymLink()) {
|
||||
// if (!QDir(di.filePath()).removeRecursively()) result = false;
|
||||
// } else {
|
||||
// QString path = di.filePath();
|
||||
// if (!path.endsWith(qstr("map0")) && !path.endsWith(qstr("map1")) && !path.endsWith(qstr("maps"))) {
|
||||
// if (!QFile::remove(di.filePath())) result = false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
} break;
|
||||
case ClearManagerDownloads:
|
||||
result = QDir(cTempDir()).removeRecursively();
|
||||
|
|
|
@ -540,6 +540,7 @@ void Account::setPasscode(const QByteArray &passcode) {
|
|||
}
|
||||
|
||||
void Account::reset() {
|
||||
auto names = collectGoodNames();
|
||||
_passcodeKeySalt.clear();
|
||||
_draftsMap.clear();
|
||||
_draftCursorsMap.clear();
|
||||
|
@ -564,6 +565,16 @@ void Account::reset() {
|
|||
_cacheBigFileTotalTimeLimit = Database::Settings().totalTimeLimit;
|
||||
_mapChanged = true;
|
||||
writeMap();
|
||||
|
||||
crl::async([base = _basePath, names = std::move(names)] {
|
||||
for (const auto &name : names) {
|
||||
if (!name.endsWith(qstr("map0"))
|
||||
&& !name.endsWith(qstr("map1"))
|
||||
&& !name.endsWith(qstr("maps"))) {
|
||||
QFile::remove(base + name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Account::writeLocations() {
|
||||
|
|
Loading…
Reference in New Issue