From 1155ab0036e29c38084607c6e45dadda3ff39b76 Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 9 Oct 2019 17:33:29 +0200 Subject: [PATCH] Use QFileInfo to check for absolute path in openLocalFileOrDir() Better not rely on a correct implmentation of std::filesystem in libstdc++ on Windows when using Qt anyways. --- CMakeLists.txt | 5 ----- misc/desktoputils.cpp | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5a50fb..2746410 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,11 +179,6 @@ set(CONFIGURATION_PACKAGE_SUFFIX find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) use_cpp_utilities() -# configure use of std::filesystem (so far only required on Windows) -if (WIN32) - use_standard_filesystem() -endif () - # include modules to apply configuration include(BasicConfig) include(QtGuiConfig) diff --git a/misc/desktoputils.cpp b/misc/desktoputils.cpp index 75b3e7f..cf26eb9 100644 --- a/misc/desktoputils.cpp +++ b/misc/desktoputils.cpp @@ -2,9 +2,8 @@ #include #include - #ifdef Q_OS_WIN32 -#include +#include #endif namespace QtUtilities { @@ -29,7 +28,7 @@ bool openLocalFileOrDir(const QString &path) tmp.replace(QChar('\\'), QChar('/')); // add a slash before the drive letter of an absolute path - if (std::filesystem::path(path.toStdString()).is_absolute()) { + if (QFileInfo(path).isAbsolute()) { tmp = QStringLiteral("/") + tmp; } url.setPath(tmp, QUrl::DecodedMode);