Browse Source

Don't use deprecated statfs64() on macOS (#15661)

Co-authored-by: Nick Korotysh <kolchaprogrammer@list.ru>
Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
7aa859a442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmake/Modules/MacroQbtCommonConfig.cmake
  2. 2
      macxconf.pri
  3. 6
      src/base/utils/fs.cpp

6
cmake/Modules/MacroQbtCommonConfig.cmake

@ -25,6 +25,12 @@ macro(qbt_common_config)
$<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG_OUTPUT> $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG_OUTPUT>
) )
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_compile_definitions(qbt_common_cfg INTERFACE
_DARWIN_FEATURE_64_BIT_INODE
)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows") if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(qbt_common_cfg INTERFACE target_compile_definitions(qbt_common_cfg INTERFACE
NTDDI_VERSION=0x06010000 NTDDI_VERSION=0x06010000

2
macxconf.pri

@ -9,6 +9,8 @@ else {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
DEFINES += _DARWIN_FEATURE_64_BIT_INODE
LIBS += -framework Carbon -framework IOKit -framework AppKit LIBS += -framework Carbon -framework IOKit -framework AppKit
QT_LANG_PATH = ../dist/qt-translations QT_LANG_PATH = ../dist/qt-translations

6
src/base/utils/fs.cpp

@ -347,15 +347,9 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
file += '/'; file += '/';
file += '.'; file += '.';
#if defined(Q_OS_MACOS)
struct statfs64 buf {};
if (statfs64(file.toLocal8Bit().constData(), &buf) != 0)
return false;
#else
struct statfs buf {}; struct statfs buf {};
if (statfs(file.toLocal8Bit().constData(), &buf) != 0) if (statfs(file.toLocal8Bit().constData(), &buf) != 0)
return false; return false;
#endif
#if defined(Q_OS_OPENBSD) #if defined(Q_OS_OPENBSD)
return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0) return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)

Loading…
Cancel
Save