mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 13:01:41 +00:00
Fixed: Remove all directories from data excepted fonts one
This commit is contained in:
parent
d436cc8144
commit
9638c01274
2 changed files with 33 additions and 9 deletions
|
@ -639,20 +639,28 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
filter << "*.string_cache";
|
filter << "*.string_cache";
|
||||||
|
|
||||||
|
// certificate should be in gamedev.bnp now
|
||||||
|
filter << "*.pem";
|
||||||
|
|
||||||
|
// only .ref files should be there
|
||||||
|
filter << "exedll*.bnp";
|
||||||
|
|
||||||
if (dir.exists("packedsheets.bnp"))
|
if (dir.exists("packedsheets.bnp"))
|
||||||
{
|
{
|
||||||
filter << "*.packed_sheets";
|
filter << "*.packed_sheets";
|
||||||
filter << "*.packed";
|
filter << "*.packed";
|
||||||
filter << "*.pem";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporary files
|
// temporary files
|
||||||
if (!dir.entryList(filter, QDir::Files).isEmpty()) return true;
|
if (!dir.entryList(filter, QDir::Files).isEmpty()) return true;
|
||||||
|
|
||||||
// fonts directory is not needed anymore
|
// temporary directories
|
||||||
if (dir.exists("fonts.bnp") && !dir.cd("fonts")) return true;
|
QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
|
||||||
return false;
|
// fonts directory is not needed anymore if fonts.bnp exists
|
||||||
|
if (!dir.exists("fonts.bnp")) dirs.removeAll("fonts");
|
||||||
|
|
||||||
|
return !dirs.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigFile::shouldCreateDesktopShortcut() const
|
bool CConfigFile::shouldCreateDesktopShortcut() const
|
||||||
|
|
|
@ -60,12 +60,21 @@ bool CFilesCleaner::exec()
|
||||||
filter << "*.packed";
|
filter << "*.packed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only .ref files should be there
|
||||||
|
filter << "exedll*.bnp";
|
||||||
|
|
||||||
// temporary files
|
// temporary files
|
||||||
QStringList files = dir.entryList(filter, QDir::Files);
|
QStringList files = dir.entryList(filter, QDir::Files);
|
||||||
|
|
||||||
|
// temporary directories
|
||||||
|
QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
|
||||||
|
// fonts directory is not needed anymore if fonts.bnp exists
|
||||||
|
if (!dir.exists("fonts.bnp")) dirs.removeAll("fonts");
|
||||||
|
|
||||||
if (m_listener)
|
if (m_listener)
|
||||||
{
|
{
|
||||||
m_listener->operationInit(0, files.size());
|
m_listener->operationInit(0, files.size() + dirs.size());
|
||||||
m_listener->operationStart();
|
m_listener->operationStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +89,20 @@ bool CFilesCleaner::exec()
|
||||||
++filesCount;
|
++filesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fonts directory is not needed anymore if fonts.bnp exists
|
foreach(const QString &d, dirs)
|
||||||
if (dir.exists("fonts.bnp") && dir.cd("fonts"))
|
{
|
||||||
|
if (dir.cd(d))
|
||||||
{
|
{
|
||||||
dir.removeRecursively();
|
dir.removeRecursively();
|
||||||
|
dir.cdUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_listener) m_listener->operationSuccess(files.size());
|
if (m_listener) m_listener->operationProgress(filesCount, d);
|
||||||
|
|
||||||
|
++filesCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_listener) m_listener->operationSuccess(files.size() + dirs.size());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue