Terminal: Fix fish shell integration

Change-Id: Ib9156be851d092db2a28641a292ae32e76314bec
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-01-25 07:03:39 +01:00
parent 6d672f7efa
commit 273656c927

View File

@@ -48,6 +48,10 @@ struct
{
FilePath script{":/terminal/shellintegrations/shellintegration-clink.lua"};
} clink;
struct
{
FilePath script{":/terminal/shellintegrations/shellintegration.fish"};
} fish;
} filesToCopy;
// clang-format on
@@ -74,6 +78,9 @@ bool ShellIntegration::canIntegrate(const Utils::CommandLine &cmdLine)
if (cmdLine.executable().baseName() == "cmd")
return true;
if (cmdLine.executable().baseName() == "fish")
return true;
return false;
}
@@ -178,6 +185,12 @@ void ShellIntegration::prepareProcess(Utils::Process &process)
env.set("CLINK_HISTORY_LABEL", "QtCreator");
env.appendOrSet("CLINK_PATH", tmpRc.parentDir().nativePath(), ";");
} else if (cmd.executable().baseName() == "fish") {
FilePath xdgDir = FilePath::fromUserInput(m_tempDir.filePath("fish_xdg_data"));
FilePath subDir = xdgDir.resolvePath(QString("fish/vendor_conf.d"));
QTC_ASSERT(subDir.createDir(), return);
filesToCopy.fish.script.copyFile(subDir.resolvePath(filesToCopy.fish.script.fileName()));
env.appendOrSet("XDG_DATA_DIRS", xdgDir.toUserOutput());
}
process.setCommand(cmd);