Use wchar version of GetDiskFreeSpaceEx on Windows Qt 5
This commit is contained in:
parent
dee1905e16
commit
639ea35921
|
@ -419,6 +419,10 @@ add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||||
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
|
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
|
||||||
add_definitions(-DQT_NO_CAST_TO_ASCII)
|
add_definitions(-DQT_NO_CAST_TO_ASCII)
|
||||||
|
|
||||||
|
if(WIN32 AND QT_MAJOR_VERSION EQUAL 5)
|
||||||
|
add_definitions(-DUNICODE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Subdirectories
|
# Subdirectories
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(dist)
|
add_subdirectory(dist)
|
||||||
|
|
|
@ -205,12 +205,8 @@ quint64 FileSystemCapacity(const QString &path) {
|
||||||
return quint64(fs_info.f_blocks) * quint64(fs_info.f_bsize);
|
return quint64(fs_info.f_blocks) * quint64(fs_info.f_bsize);
|
||||||
#elif defined(Q_OS_WIN32)
|
#elif defined(Q_OS_WIN32)
|
||||||
_ULARGE_INTEGER ret;
|
_ULARGE_INTEGER ret;
|
||||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
ScopedWCharArray wchar(QDir::toNativeSeparators(path));
|
ScopedWCharArray wchar(QDir::toNativeSeparators(path));
|
||||||
if (GetDiskFreeSpaceEx(wchar.get(), nullptr, &ret, nullptr) != 0)
|
if (GetDiskFreeSpaceEx(wchar.get(), nullptr, &ret, nullptr) != 0)
|
||||||
# else
|
|
||||||
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), nullptr, &ret, nullptr) != 0)
|
|
||||||
# endif
|
|
||||||
return ret.QuadPart;
|
return ret.QuadPart;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -226,12 +222,8 @@ quint64 FileSystemFreeSpace(const QString &path) {
|
||||||
return quint64(fs_info.f_bavail) * quint64(fs_info.f_bsize);
|
return quint64(fs_info.f_bavail) * quint64(fs_info.f_bsize);
|
||||||
#elif defined(Q_OS_WIN32)
|
#elif defined(Q_OS_WIN32)
|
||||||
_ULARGE_INTEGER ret;
|
_ULARGE_INTEGER ret;
|
||||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
ScopedWCharArray wchar(QDir::toNativeSeparators(path));
|
ScopedWCharArray wchar(QDir::toNativeSeparators(path));
|
||||||
if (GetDiskFreeSpaceEx(wchar.get(), &ret, nullptr, nullptr) != 0)
|
if (GetDiskFreeSpaceEx(wchar.get(), &ret, nullptr, nullptr) != 0)
|
||||||
# else
|
|
||||||
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), &ret, nullptr, nullptr) != 0)
|
|
||||||
# endif
|
|
||||||
return ret.QuadPart;
|
return ret.QuadPart;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue