Put terminal shell integration scripts in build
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 19 Oct 2016 17:12:32 +0000 (19:12 +0200)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 19 Oct 2016 17:12:32 +0000 (19:12 +0200)
build/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java

index 8673ad5941426c71e10438df3fc1bb139c1949f1..1918ebb1733fa4d800813ff0756850a891d7ae54 100644 (file)
@@ -238,7 +238,11 @@ class CommunityRepositoryModules {
       withModule("java-decompiler-engine", mainJarName)
       doNotCreateSeparateJarForLocalizableResources()
     },
-    javaFXPlugin("javaFX-CE")
+    javaFXPlugin("javaFX-CE"),
+    plugin("terminal") {
+      withResource("resources/.zshrc", "")
+      withResource("resources/jediterm-sh.in", "")
+    }
   ]
 
   static PluginLayout androidPlugin(Map<String, String> additionalModulesToJars) {
index 2a07d9e99870a3b64371fc6a2829af8ab8450c42..17b6d134569445767f0bac4b8d596f24e3a04767 100644 (file)
@@ -34,6 +34,7 @@ import com.intellij.util.containers.HashMap;
 import com.jediterm.pty.PtyProcessTtyConnector;
 import com.jediterm.terminal.TtyConnector;
 import com.pty4j.PtyProcess;
+import com.pty4j.util.PtyUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -81,6 +82,12 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
           rcfile = ".zshrc";
         }
         URL resource = LocalTerminalDirectRunner.class.getClassLoader().getResource(rcfile);
+        if (resource != null && "jar".equals(resource.getProtocol())) {
+          File file = new File(new File(PtyUtil.getJarContainingFolderPath(LocalTerminalDirectRunner.class)).getParent(), rcfile);
+          if (file.exists()) {
+            return file.getAbsolutePath();
+          }
+        }
         if (resource != null) {
           URI uri = resource.toURI();
           return uri.getPath();