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.
This commit is contained in:
Martchus 2019-10-09 17:33:29 +02:00
parent df03b97ced
commit 1155ab0036
2 changed files with 2 additions and 8 deletions

View File

@ -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)

View File

@ -2,9 +2,8 @@
#include <QDesktopServices>
#include <QUrl>
#ifdef Q_OS_WIN32
#include <filesystem>
#include <QFileInfo>
#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);