diff --git a/Source/Editor/Scripting/CodeEditors/VisualStudioCodeEditor.cpp b/Source/Editor/Scripting/CodeEditors/VisualStudioCodeEditor.cpp index 280f7fced..8c993ad25 100644 --- a/Source/Editor/Scripting/CodeEditors/VisualStudioCodeEditor.cpp +++ b/Source/Editor/Scripting/CodeEditors/VisualStudioCodeEditor.cpp @@ -42,6 +42,30 @@ void VisualStudioCodeEditor::FindEditors(Array* output) { output->Add(New(path, isInsiders)); } +#elif PLATFORM_LINUX + char buffer[128]; + FILE* pipe = popen("/bin/bash -c \"type -p code\"", "r"); + if (pipe) + { + StringAnsi pathAnsi; + while (fgets(buffer, sizeof(buffer), pipe) != NULL) + pathAnsi += buffer; + pclose(pipe); + const String path(pathAnsi.Get(), pathAnsi.Length() != 0 ? pathAnsi.Length() - 1 : 0); + if (FileSystem::FileExists(path)) + { + output->Add(New(path, false)); + return; + } + } + { + const String path(TEXT("/usr/bin/code")); + if (FileSystem::FileExists(path)) + { + output->Add(New(path, false)); + return; + } + } #endif }