forked from qt-creator/qt-creator
Squish: Fix handling of object map
Fix resolving the path to the object map and if no object map exists yet create it. As on it fix a typo inside the writing of the file. Change-Id: I832a2f71bbf5c5d4947e3edba8f79a00a3b6a536 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -226,7 +226,7 @@ Core::IDocument::OpenResult ObjectsMapDocument::openImpl(QString *error,
|
|||||||
|
|
||||||
bool ObjectsMapDocument::writeFile(const Utils::FilePath &fileName) const
|
bool ObjectsMapDocument::writeFile(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
if (fileName.endsWith("object.map")) {
|
if (fileName.endsWith("objects.map")) {
|
||||||
Utils::FileSaver saver(fileName);
|
Utils::FileSaver saver(fileName);
|
||||||
return saver.write(contents()) && saver.finalize();
|
return saver.write(contents()) && saver.finalize();
|
||||||
}
|
}
|
||||||
|
@@ -465,13 +465,15 @@ void SquishFileHandler::openObjectsMap(const QString &suiteName)
|
|||||||
|
|
||||||
const SuiteConf conf = SuiteConf::readSuiteConf(m_suites.value(suiteName));
|
const SuiteConf conf = SuiteConf::readSuiteConf(m_suites.value(suiteName));
|
||||||
const Utils::FilePath objectsMapPath = conf.objectMapPath();
|
const Utils::FilePath objectsMapPath = conf.objectMapPath();
|
||||||
if (objectsMapPath.exists()) {
|
QTC_ASSERT(!objectsMapPath.isEmpty(), return);
|
||||||
if (!Core::EditorManager::openEditor(objectsMapPath, Constants::OBJECTSMAP_EDITOR_ID)) {
|
|
||||||
QMessageBox::critical(Core::ICore::dialogParent(),
|
QTC_ASSERT(conf.ensureObjectMapExists(), return);
|
||||||
Tr::tr("Error"),
|
|
||||||
Tr::tr("Failed to open objects.map file at \"%1\".")
|
if (!Core::EditorManager::openEditor(objectsMapPath, Constants::OBJECTSMAP_EDITOR_ID)) {
|
||||||
.arg(objectsMapPath.toUserOutput()));
|
QMessageBox::critical(Core::ICore::dialogParent(),
|
||||||
}
|
Tr::tr("Error"),
|
||||||
|
Tr::tr("Failed to open objects.map file at \"%1\".")
|
||||||
|
.arg(objectsMapPath.toUserOutput()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -189,7 +189,7 @@ Utils::FilePath SuiteConf::objectMapPath() const
|
|||||||
if (m_objectMapStyle == "script")
|
if (m_objectMapStyle == "script")
|
||||||
return suiteDir.resolvePath("shared/scripts/names" + scriptExtension());
|
return suiteDir.resolvePath("shared/scripts/names" + scriptExtension());
|
||||||
|
|
||||||
return suiteDir.resolvePath(m_objectMap);
|
return suiteDir.resolvePath(m_objectMap.isEmpty() ? QString{"objects.map"} : m_objectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SuiteConf::scriptExtension() const
|
QString SuiteConf::scriptExtension() const
|
||||||
|
Reference in New Issue
Block a user