From f9a7f613bdedf9bf5eff394f586fc03828865c20 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Sun, 22 Aug 2010 18:33:08 +0400 Subject: [PATCH] suggest interpreter home paths for IronPython --- .../python/sdk/IronPythonSdkFlavor.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/python/src/com/jetbrains/python/sdk/IronPythonSdkFlavor.java b/python/src/com/jetbrains/python/sdk/IronPythonSdkFlavor.java index ac9bf8fdd757..92affd78210c 100644 --- a/python/src/com/jetbrains/python/sdk/IronPythonSdkFlavor.java +++ b/python/src/com/jetbrains/python/sdk/IronPythonSdkFlavor.java @@ -3,8 +3,10 @@ package com.jetbrains.python.sdk; import com.intellij.execution.configurations.GeneralCommandLine; import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.List; /** * @author yole @@ -15,6 +17,27 @@ public class IronPythonSdkFlavor extends PythonSdkFlavor { public static IronPythonSdkFlavor INSTANCE = new IronPythonSdkFlavor(); + @Override + public List suggestHomePaths() { + List result = new ArrayList(); + String root = System.getenv("ProgramFiles(x86)"); + if (root == null) { + root = System.getenv("ProgramFiles"); + } + if (root != null) { + final File[] dirs = new File(root).listFiles(); + for (File dir : dirs) { + if (dir.getName().startsWith("IronPython")) { + File ipy = new File(dir, "ipy.exe"); + if (ipy.exists()) { + result.add(ipy.getPath()); + } + } + } + } + return result; + } + @Override public boolean isValidSdkHome(String path) { final String name = new File(path).getName();