forked from qt-creator/qt-creator
"Open Terminal Here" should open Terminal.app on Mac.
It was starting X11 and a xterm... Task-number: QTCREATORBUG-4683
This commit is contained in:
29
share/qtcreator/scripts/openTerminal.command
Executable file
29
share/qtcreator/scripts/openTerminal.command
Executable file
@@ -0,0 +1,29 @@
|
||||
#! /bin/bash
|
||||
|
||||
i=`pwd`
|
||||
i=${i//\\/\\\\\\\\}
|
||||
i=${i//\"/\\\\\\\"}
|
||||
i=${i//\$/\\\\\\\$}
|
||||
i=${i//\`/\\\\\\\`}
|
||||
i=\\\"$i\\\"
|
||||
osascript <<EOF
|
||||
--Terminal opens a window by default when it is not running, so check
|
||||
on applicationIsRunning(applicationName)
|
||||
tell application "System Events" to count (every process whose name is applicationName)
|
||||
return result is greater than 0
|
||||
end applicationIsRunning
|
||||
set terminalWasRunning to applicationIsRunning("Terminal")
|
||||
|
||||
set cdScript to "cd $i"
|
||||
tell application "Terminal"
|
||||
--do script will open a new window if none given, but terminal already opens one if not running
|
||||
if terminalWasRunning then
|
||||
do script cdScript
|
||||
else
|
||||
do script cdScript in first window
|
||||
end if
|
||||
set currentTab to the result
|
||||
set currentWindow to first window whose tabs contains currentTab
|
||||
activate
|
||||
end tell
|
||||
EOF
|
||||
@@ -38,6 +38,7 @@ DATA_DIRS = \
|
||||
qml-type-descriptions \
|
||||
generic-highlighter \
|
||||
glsl
|
||||
macx: DATA_DIRS += scripts
|
||||
|
||||
# conditionally deployed data
|
||||
!isEmpty(copydata) {
|
||||
|
||||
@@ -441,6 +441,10 @@ void FolderNavigationWidget::openTerminal(const QString &path)
|
||||
#ifdef Q_OS_WIN
|
||||
const QString terminalEmulator = QString::fromLocal8Bit(qgetenv("COMSPEC"));
|
||||
const QStringList args; // none
|
||||
#elif defined(Q_WS_MAC)
|
||||
const QString terminalEmulator = Core::ICore::instance()->resourcePath()
|
||||
+ QLatin1String("/scripts/openTerminal.command");
|
||||
QStringList args;
|
||||
#else
|
||||
QStringList args = Utils::QtcProcess::splitArgs(
|
||||
Utils::ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings()));
|
||||
|
||||
Reference in New Issue
Block a user