mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
Fixed: Don't try to use a directory if empty
--HG-- branch : develop
This commit is contained in:
parent
bd766614bc
commit
78730c0dd4
3 changed files with 23 additions and 11 deletions
|
@ -502,6 +502,8 @@ bool CConfigFile::isRyzomInstalledIn(const QString &directory) const
|
|||
|
||||
bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const
|
||||
{
|
||||
if (directory.isEmpty()) return false;
|
||||
|
||||
QDir dir(directory);
|
||||
|
||||
// directory doesn't exist
|
||||
|
@ -528,6 +530,8 @@ bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const
|
|||
|
||||
bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
|
||||
{
|
||||
if (directory.isEmpty()) return false;
|
||||
|
||||
QDir dir(directory);
|
||||
|
||||
// directory doesn't exist
|
||||
|
@ -557,6 +561,8 @@ bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
|
|||
|
||||
bool CConfigFile::foundTemporaryFiles(const QString &directory) const
|
||||
{
|
||||
if (directory.isEmpty()) return false;
|
||||
|
||||
QDir dir(directory);
|
||||
|
||||
// directory doesn't exist
|
||||
|
|
|
@ -52,6 +52,8 @@ void CFilesCleaner::setDirectory(const QString &src)
|
|||
|
||||
bool CFilesCleaner::exec()
|
||||
{
|
||||
if (m_directory.isEmpty()) return false;
|
||||
|
||||
if (m_listener) m_listener->operationPrepare();
|
||||
|
||||
QDir dir(m_directory);
|
||||
|
|
|
@ -37,23 +37,27 @@ QString qBytesToHumanReadable(qint64 bytes)
|
|||
qint64 getDirectorySize(const QString &directory)
|
||||
{
|
||||
qint64 size = 0;
|
||||
QDir dir(directory);
|
||||
|
||||
if (dir.exists())
|
||||
if (!directory.isEmpty())
|
||||
{
|
||||
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||
QDir dir(directory);
|
||||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
if (dir.exists())
|
||||
{
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||
|
||||
if (fileInfo.isDir())
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
size += getDirectorySize(fileInfo.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
size += fileInfo.size();
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
|
||||
if (fileInfo.isDir())
|
||||
{
|
||||
size += getDirectorySize(fileInfo.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
size += fileInfo.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue