From 7aa859a442d4ed400873d4e5150e87760a5739d5 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 2 Nov 2021 10:41:09 +0800 Subject: [PATCH] Don't use deprecated statfs64() on macOS (#15661) Co-authored-by: Nick Korotysh Co-authored-by: Chocobo1 --- cmake/Modules/MacroQbtCommonConfig.cmake | 6 ++++++ macxconf.pri | 2 ++ src/base/utils/fs.cpp | 6 ------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmake/Modules/MacroQbtCommonConfig.cmake b/cmake/Modules/MacroQbtCommonConfig.cmake index 610db40e8..7fc028489 100644 --- a/cmake/Modules/MacroQbtCommonConfig.cmake +++ b/cmake/Modules/MacroQbtCommonConfig.cmake @@ -25,6 +25,12 @@ macro(qbt_common_config) $<$>: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") target_compile_definitions(qbt_common_cfg INTERFACE NTDDI_VERSION=0x06010000 diff --git a/macxconf.pri b/macxconf.pri index 96bc47b3a..b12e34e39 100644 --- a/macxconf.pri +++ b/macxconf.pri @@ -9,6 +9,8 @@ else { QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 +DEFINES += _DARWIN_FEATURE_64_BIT_INODE + LIBS += -framework Carbon -framework IOKit -framework AppKit QT_LANG_PATH = ../dist/qt-translations diff --git a/src/base/utils/fs.cpp b/src/base/utils/fs.cpp index 04ec4e4b8..a273a48c6 100644 --- a/src/base/utils/fs.cpp +++ b/src/base/utils/fs.cpp @@ -347,15 +347,9 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path) file += '/'; file += '.'; -#if defined(Q_OS_MACOS) - struct statfs64 buf {}; - if (statfs64(file.toLocal8Bit().constData(), &buf) != 0) - return false; -#else struct statfs buf {}; if (statfs(file.toLocal8Bit().constData(), &buf) != 0) return false; -#endif #if defined(Q_OS_OPENBSD) return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)