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:
parent
df03b97ced
commit
1155ab0036
|
@ -179,11 +179,6 @@ set(CONFIGURATION_PACKAGE_SUFFIX
|
||||||
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
||||||
use_cpp_utilities()
|
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 modules to apply configuration
|
||||||
include(BasicConfig)
|
include(BasicConfig)
|
||||||
include(QtGuiConfig)
|
include(QtGuiConfig)
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
#include <filesystem>
|
#include <QFileInfo>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace QtUtilities {
|
namespace QtUtilities {
|
||||||
|
@ -29,7 +28,7 @@ bool openLocalFileOrDir(const QString &path)
|
||||||
tmp.replace(QChar('\\'), QChar('/'));
|
tmp.replace(QChar('\\'), QChar('/'));
|
||||||
|
|
||||||
// add a slash before the drive letter of an absolute path
|
// 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;
|
tmp = QStringLiteral("/") + tmp;
|
||||||
}
|
}
|
||||||
url.setPath(tmp, QUrl::DecodedMode);
|
url.setPath(tmp, QUrl::DecodedMode);
|
||||||
|
|
Loading…
Reference in New Issue