From 53bfb09a8572b11b3f91e3fef75639b800dbd8be Mon Sep 17 00:00:00 2001 From: okrc Date: Thu, 12 Jan 2023 04:07:58 +0800 Subject: [PATCH] Fixed issue with shortcut --- SandboxiePlus/SandMan/BoxMonitor.cpp | 9 ++++++++- SandboxiePlus/SandMan/SbiePlusAPI.cpp | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/SandboxiePlus/SandMan/BoxMonitor.cpp b/SandboxiePlus/SandMan/BoxMonitor.cpp index a21a5ba1..312df73d 100644 --- a/SandboxiePlus/SandMan/BoxMonitor.cpp +++ b/SandboxiePlus/SandMan/BoxMonitor.cpp @@ -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(); } diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index 5a23fd9e..b71f453b 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -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; -} \ No newline at end of file +}