Commit 0f139b27 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Projectexplorer: Fix hang when launching external explorer for folder.


Task-number: QTCREATORBUG-221

Use QProcess::startDetached.
Reviewed-by: default avatarcon <qtc-committer@nokia.com>
parent 64a08d15
......@@ -1864,16 +1864,14 @@ void ProjectExplorerPlugin::showInGraphicalShell()
{
QTC_ASSERT(d->m_currentNode, return)
#if defined(Q_OS_WIN)
QString explorer = Environment::systemEnvironment().searchInPath("explorer.exe");
const QString explorer = Environment::systemEnvironment().searchInPath("explorer.exe");
if (explorer.isEmpty()) {
QMessageBox::warning(Core::ICore::instance()->mainWindow(),
tr("Launching Windows Explorer failed"),
tr("Could not find explorer.exe in path to launch Windows Explorer."));
return;
}
QProcess::execute(explorer,
QStringList() << QString("/select,%1")
.arg(QDir::toNativeSeparators(d->m_currentNode->path())));
QProcess::startDetached(explorer, QStringList(QLatin1String("/select,") + QDir::toNativeSeparators(d->m_currentNode->path())));
#elif defined(Q_OS_MAC)
QProcess::execute("/usr/bin/osascript", QStringList()
<< "-e"
......@@ -1884,15 +1882,15 @@ void ProjectExplorerPlugin::showInGraphicalShell()
<< "tell application \"Finder\" to activate");
#else
// we cannot select a file here, because no file browser really supports it...
QFileInfo fileInfo(d->m_currentNode->path());
QString xdgopen = Environment::systemEnvironment().searchInPath("xdg-open");
const QFileInfo fileInfo(d->m_currentNode->path());
const QString xdgopen = Environment::systemEnvironment().searchInPath("xdg-open");
if (xdgopen.isEmpty()) {
QMessageBox::warning(Core::ICore::instance()->mainWindow(),
tr("Launching a file explorer failed"),
tr("Could not find xdg-open to launch the native file explorer."));
return;
}
QProcess::execute(xdgopen, QStringList() << fileInfo.path());
QProcess::startDetached(xdgopen, QStringList(fileInfo.path()));
#endif
}
......
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