forked from qt-creator/qt-creator
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:
@@ -234,9 +234,10 @@ public:
|
||||
[[nodiscard]] static int rootLength(const QStringView path); // Assumes no scheme and host
|
||||
[[nodiscard]] static int schemeAndHostLength(const QStringView path);
|
||||
|
||||
static QString calcRelativePath(const QString &absolutePath, const QString &absoluteAnchorPath);
|
||||
|
||||
private:
|
||||
friend class ::tst_fileutils;
|
||||
static QString calcRelativePath(const QString &absolutePath, const QString &absoluteAnchorPath);
|
||||
void setPath(QStringView path);
|
||||
void setFromString(const QString &filepath);
|
||||
DeviceFileAccess *fileAccess() const;
|
||||
|
@@ -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
|
||||
|
@@ -8,9 +8,7 @@
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
|
||||
namespace Core {
|
||||
|
||||
namespace Internal {
|
||||
namespace Core::Internal {
|
||||
|
||||
class UtilsJsExtension : public QObject
|
||||
{
|
||||
@@ -59,5 +57,4 @@ public:
|
||||
Q_INVOKABLE QString qtQuickVersion(const QString &filePath) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
} // Core::Internal
|
||||
|
Reference in New Issue
Block a user