aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/terminalhooks.cpp
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2023-03-01 09:57:43 +0100
committerMarcus Tillmanns <[email protected]>2023-03-02 14:13:19 +0000
commit86da87d3062adea1a1eb64426750978d19043492 (patch)
treeed0cb32aa7e8f02a1232caddaca5672efb64301b /src/libs/utils/terminalhooks.cpp
parent517400e7f6fc345ab69daf6f49b7068752452d8e (diff)
ProjectExplorer: Remove IDevice::terminalCommand
Since Terminals can now be started for device file paths, there is no need anymore for IDevice::terminalCommand. Change-Id: I01c831ea7ee29d53efa6880631e8c6d54a4316aa Reviewed-by: Cristian Adam <[email protected]>
Diffstat (limited to 'src/libs/utils/terminalhooks.cpp')
-rw-r--r--src/libs/utils/terminalhooks.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libs/utils/terminalhooks.cpp b/src/libs/utils/terminalhooks.cpp
index df27e0404b9..f4a5944dbdc 100644
--- a/src/libs/utils/terminalhooks.cpp
+++ b/src/libs/utils/terminalhooks.cpp
@@ -8,6 +8,24 @@
namespace Utils::Terminal {
+FilePath defaultShellForDevice(const FilePath &deviceRoot)
+{
+ if (!deviceRoot.needsDevice())
+ return {};
+
+ // TODO: Windows ?
+ const Environment env = deviceRoot.deviceEnvironment();
+ FilePath shell = FilePath::fromUserInput(env.value_or("SHELL", "/bin/sh"));
+
+ if (!shell.isAbsolutePath())
+ shell = env.searchInPath(shell.nativePath());
+
+ if (shell.isEmpty())
+ return shell;
+
+ return shell.onDevice(deviceRoot);
+}
+
struct HooksPrivate
{
HooksPrivate()