diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-05-07 13:35:21 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-05-07 12:34:31 +0000 |
commit | 13a947d119c4722461759f1aeb6b61e93e9be210 (patch) | |
tree | 76752b5edfebc069d49588b3cc898a5fab8cecbf | |
parent | d2bb73ffb287e54854696ef9fa684696593dbeea (diff) |
Debugger: Fix attaching to running debug server
For example when developing on Windows, cross compiling to Linux, the
result is not executable from the Windows perspective.
Reverts f2cfd3c01a2876150aa7fdc0a44adee33029f2c9 which changed the code
to use ExistingCommand to get the automatic expansion of app bundles on
OS X, and do automatic expansion of app bundles also when using path
chooser of type File. Choosing an app bundle in a path chooser of type
File would previously lead to an invalid entry in the path chooser
anyhow, because the app bundle itself is not a file.
Change-Id: Ie710c47918d2b8735009e290301ed2683e354f2c
Task-number: QTCREATORBUG-14412
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r-- | src/libs/utils/pathchooser.cpp | 25 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerdialogs.cpp | 2 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 1c1a0c1bbf..6b5c001df9 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -53,6 +53,20 @@ This class has some validation logic for embedding into QWizardPage. */ +static QString appBundleExpandedPath(const QString &path) +{ + if (Utils::HostOsInfo::hostOs() == Utils::OsTypeMac && path.endsWith(QLatin1String(".app"))) { + // possibly expand to Foo.app/Contents/MacOS/Foo + QFileInfo info(path); + if (info.isDir()) { + QString exePath = path + QLatin1String("/Contents/MacOS/") + info.completeBaseName(); + if (QFileInfo(exePath).exists()) + return exePath; + } + } + return path; +} + namespace Utils { // ------------------ PathValidatingLineEdit @@ -387,20 +401,13 @@ void PathChooser::slotBrowse() newPath = QFileDialog::getOpenFileName(this, makeDialogTitle(tr("Choose Executable")), predefined, d->m_dialogFilter); - if (HostOsInfo::hostOs() == OsTypeMac && newPath.endsWith(QLatin1String(".app"))) { - // possibly expand to Foo.app/Contents/MacOS/Foo - QFileInfo info(newPath); - if (info.isDir()) { - QString exePath = newPath + QLatin1String("/Contents/MacOS/") + info.completeBaseName(); - if (QFileInfo(exePath).isExecutable()) - newPath = exePath; - } - } + newPath = appBundleExpandedPath(newPath); break; case PathChooser::File: // fall through newPath = QFileDialog::getOpenFileName(this, makeDialogTitle(tr("Choose File")), predefined, d->m_dialogFilter); + newPath = appBundleExpandedPath(newPath); break; case PathChooser::SaveFile: newPath = QFileDialog::getSaveFileName(this, diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 066323c193..d622e6da71 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -248,7 +248,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) d->serverAddressEdit = new QLineEdit(this); d->localExecutablePathChooser = new PathChooser(this); - d->localExecutablePathChooser->setExpectedKind(PathChooser::ExistingCommand); + d->localExecutablePathChooser->setExpectedKind(PathChooser::File); d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable")); d->localExecutablePathChooser->setHistoryCompleter(QLatin1String("LocalExecutable")); |