Core: Make UtilsJsExtension::relativeFilePath() work on remote

Task-number: QTCREATORBUG-28355
Change-Id: I67fad186ed31e42688835b38177f3fb7cd59c1d0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-11-29 17:38:45 +01:00
parent ad072db2b6
commit 5f4a5802cc
3 changed files with 11 additions and 11 deletions

View File

@@ -16,8 +16,9 @@
#include <QVariant>
#include <QVersionNumber>
namespace Core {
namespace Internal {
using namespace Utils;
namespace Core::Internal {
QString UtilsJsExtension::qtVersion() const
{
@@ -83,7 +84,9 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const
QString UtilsJsExtension::relativeFilePath(const QString &path, const QString &base) const
{
return QDir(base).relativeFilePath(path);
const FilePath basePath = FilePath::fromString(base).cleanPath();
const FilePath filePath = FilePath::fromString(path).cleanPath();
return FilePath::calcRelativePath(filePath.toFSPathString(), basePath.toFSPathString());
}
bool UtilsJsExtension::exists(const QString &in) const
@@ -175,5 +178,4 @@ QString UtilsJsExtension::qtQuickVersion(const QString &filePath) const
return QLatin1String("2.15");
}
} // namespace Internal
} // namespace Core
} // Core::Internal