Skip to content
Permalink
Browse files

implemented to show file size on disk for Windows.(refs #33)

  • Loading branch information...
haraki committed Jun 24, 2019
1 parent dd08c2e commit ed9af8c4a5df1281b8a9b4a357ab643811d3de2e
Showing with 12 additions and 2 deletions.
  1. +12 −2 file.cpp
@@ -9,8 +9,9 @@
#include "mainwindow.h"

#ifdef Q_OS_WIN
# include <Windows.h>
#else
#include <sys/stat.h>
# include <sys/stat.h>
#endif

namespace Farman
@@ -29,7 +30,16 @@ File::~File()
qint64 File::getFileSizeOnDisk(const QString& filePath)
{
#ifdef Q_OS_WIN
return 0;
DWORD fileSizeH, fileSizeL;
fileSizeL = ::GetCompressedFileSize(filePath.toStdWString().c_str(), &fileSizeH);
if(fileSizeL == static_cast<DWORD>(-1))
{
return -1;
}

qDebug() << "fileSizeH : " << fileSizeH << ", fileSizeL : " << fileSizeL;

return (static_cast<qint64>(fileSizeH) << 32) | fileSizeL;
#else
struct stat statBuf;

0 comments on commit ed9af8c

Please sign in to comment.
You can’t perform that action at this time.