Commit 13a947d1 authored by Eike Ziller's avatar Eike Ziller
Browse files

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 f2cfd3c0

 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's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent d2bb73ff
...@@ -53,6 +53,20 @@ ...@@ -53,6 +53,20 @@
This class has some validation logic for embedding into QWizardPage. 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 { namespace Utils {
// ------------------ PathValidatingLineEdit // ------------------ PathValidatingLineEdit
...@@ -387,20 +401,13 @@ void PathChooser::slotBrowse() ...@@ -387,20 +401,13 @@ void PathChooser::slotBrowse()
newPath = QFileDialog::getOpenFileName(this, newPath = QFileDialog::getOpenFileName(this,
makeDialogTitle(tr("Choose Executable")), predefined, makeDialogTitle(tr("Choose Executable")), predefined,
d->m_dialogFilter); d->m_dialogFilter);
if (HostOsInfo::hostOs() == OsTypeMac && newPath.endsWith(QLatin1String(".app"))) { newPath = appBundleExpandedPath(newPath);
// 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;
}
}
break; break;
case PathChooser::File: // fall through case PathChooser::File: // fall through
newPath = QFileDialog::getOpenFileName(this, newPath = QFileDialog::getOpenFileName(this,
makeDialogTitle(tr("Choose File")), predefined, makeDialogTitle(tr("Choose File")), predefined,
d->m_dialogFilter); d->m_dialogFilter);
newPath = appBundleExpandedPath(newPath);
break; break;
case PathChooser::SaveFile: case PathChooser::SaveFile:
newPath = QFileDialog::getSaveFileName(this, newPath = QFileDialog::getSaveFileName(this,
......
...@@ -248,7 +248,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) ...@@ -248,7 +248,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
d->serverAddressEdit = new QLineEdit(this); d->serverAddressEdit = new QLineEdit(this);
d->localExecutablePathChooser = new PathChooser(this); d->localExecutablePathChooser = new PathChooser(this);
d->localExecutablePathChooser->setExpectedKind(PathChooser::ExistingCommand); d->localExecutablePathChooser->setExpectedKind(PathChooser::File);
d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable")); d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable"));
d->localExecutablePathChooser->setHistoryCompleter(QLatin1String("LocalExecutable")); d->localExecutablePathChooser->setHistoryCompleter(QLatin1String("LocalExecutable"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment