Merge pull request #2601 from okrc/patch-1

Fixed issue with shortcuts
This commit is contained in:
DavidXanatos 2023-01-12 09:00:48 +01:00 committed by GitHub
commit e833b49209
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -26,10 +26,17 @@ quint64 CBoxMonitor::CounDirSize(const QString& Directory, SBox* Box)
return TotalSize;
QDir Dir(Directory);
foreach(const QFileInfo & Info, Dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot))
foreach(const QFileInfo & Info, Dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot))
{
if (Info.isDir())
TotalSize += CounDirSize(Info.filePath(), Box);
else if (Info.isShortcut())
{
QFile File(Info.filePath());
if (File.open(QFile::ReadOnly))
TotalSize += File.size();
File.close();
}
else
TotalSize += QFile(Info.filePath()).size();
}

View File

@ -166,6 +166,19 @@ public:
return QFile::open(flags);
}
qint64 size() const override
{
qint64 Size = QFile::size();
if (QFileInfo(fileName()).isShortcut())
{
QFile File(fileName());
if (File.open(QFile::ReadOnly))
Size = File.size();
File.close();
}
return Size;
}
protected:
CSbieProgressPtr m_pProgress;
CArchive* m_pArchive;
@ -974,4 +987,4 @@ QString CSandBoxPlus::GetCommandFile(const QString& Command)
Path.prepend(m_FilePath);
return Path;
}
}