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
|
||||
{
|
||||
if (fileName.endsWith("object.map")) {
|
||||
if (fileName.endsWith("objects.map")) {
|
||||
Utils::FileSaver saver(fileName);
|
||||
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 Utils::FilePath objectsMapPath = conf.objectMapPath();
|
||||
if (objectsMapPath.exists()) {
|
||||
if (!Core::EditorManager::openEditor(objectsMapPath, Constants::OBJECTSMAP_EDITOR_ID)) {
|
||||
QMessageBox::critical(Core::ICore::dialogParent(),
|
||||
Tr::tr("Error"),
|
||||
Tr::tr("Failed to open objects.map file at \"%1\".")
|
||||
.arg(objectsMapPath.toUserOutput()));
|
||||
}
|
||||
QTC_ASSERT(!objectsMapPath.isEmpty(), return);
|
||||
|
||||
QTC_ASSERT(conf.ensureObjectMapExists(), return);
|
||||
|
||||
if (!Core::EditorManager::openEditor(objectsMapPath, Constants::OBJECTSMAP_EDITOR_ID)) {
|
||||
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")
|
||||
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
|
||||
|
Reference in New Issue
Block a user