forked from qt-creator/qt-creator
McuSupport: fix issue with resolving relative paths
FilePath::resolvePath accepts a FilePath param, but treats leading hashes as indication of an absolute path. FilePath::pathAppended only accepts QString, but understands that the param is always a relative path. In our case we always want to treat the paths as relative. Change-Id: Ib23c27e76500de8a89d9dd22cd7efb95a9bd4d6d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -98,7 +98,7 @@ FilePath McuPackage::basePath() const
|
||||
|
||||
FilePath McuPackage::path() const
|
||||
{
|
||||
return basePath().resolvePath(m_relativePathModifier).absoluteFilePath();
|
||||
return basePath().pathAppended(m_relativePathModifier.path()).absoluteFilePath();
|
||||
}
|
||||
|
||||
FilePath McuPackage::defaultPath() const
|
||||
@@ -121,7 +121,7 @@ void McuPackage::updatePath()
|
||||
void McuPackage::updateStatus()
|
||||
{
|
||||
bool validPath = !m_path.isEmpty() && m_path.exists();
|
||||
const FilePath detectionPath = basePath().resolvePath(m_detectionPath);
|
||||
const FilePath detectionPath = basePath().pathAppended(m_detectionPath.path());
|
||||
const bool validPackage = m_detectionPath.isEmpty() || detectionPath.exists();
|
||||
m_detectedVersion = validPath && validPackage && m_versionDetector
|
||||
? m_versionDetector->parseVersion(basePath().toString())
|
||||
|
@@ -58,7 +58,7 @@ QString McuPackageExecutableVersionDetector::parseVersion(const QString &package
|
||||
if (m_detectionPath.isEmpty() || m_detectionRegExp.isEmpty())
|
||||
return QString();
|
||||
|
||||
const Utils::FilePath binaryPath = Utils::FilePath::fromString(packagePath).resolvePath(m_detectionPath);
|
||||
const Utils::FilePath binaryPath = Utils::FilePath::fromString(packagePath).pathAppended(m_detectionPath.path());
|
||||
if (!binaryPath.exists())
|
||||
return QString();
|
||||
|
||||
|
Reference in New Issue
Block a user