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 f2cfd3c01a 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>
This commit is contained in:
Eike Ziller
2015-05-07 13:35:21 +02:00
parent d2bb73ffb2
commit 13a947d119
2 changed files with 17 additions and 10 deletions

View File

@@ -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,

View File

@@ -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"));