// return autoPath;
}
public static RutaPackage[] getSrcs(IExecutionEnvironment exeEnv, IFileHandle installLocation,
EnvironmentVariable[] environment, String packageName) {
IDeployment deployment = exeEnv.createDeployment();
IFileHandle script = deploy(deployment);
if (script == null) {
return null;
}
IFileHandle workingDir = script.getParent();
InterpreterConfig config = ScriptLaunchUtil.createInterpreterConfig(exeEnv, script, workingDir,
environment);
String names = packageName;
ByteArrayInputStream bais = new ByteArrayInputStream(names.getBytes());
IPath packagesPath = null;
try {
packagesPath = deployment.add(bais, "packages.txt"); //$NON-NLS-1$
} catch (IOException e1) {
if (DLTKCore.DEBUG) {
e1.printStackTrace();
}
return null;
}
IFileHandle file = deployment.getFile(packagesPath);
// For wish
config.removeEnvVar("DISPLAY"); //$NON-NLS-1$
String[] arguments = new String[] { "get-srcs", "-fpkgs", //$NON-NLS-1$ //$NON-NLS-2$
file.toOSString() };
config.addScriptArgs(arguments);
Process process = null;
try {
process = ScriptLaunchUtil.runScriptWithInterpreter(exeEnv, installLocation.toOSString(),
config);
} catch (CoreException e) {
if (DLTKCore.DEBUG) {
e.printStackTrace();
}
}
if (process == null) {
return null;
}
List output = getScriptOutput(process.getInputStream());
getScriptOutput(process.getErrorStream());
process.destroy();
deployment.dispose();
return getPackagePath(output);
}