if (projectDir == null) {
throw new CantRunException("Could not retrieve the project directory");
}
final SimpleProgramParameters params = new SimpleProgramParameters();
ProgramParametersUtil.configureConfiguration(params, rustConfiguration);
String outputPath = CompilerPaths.getModuleOutputPath(rustConfiguration.getModules()[0], false);
if (outputPath == null) {
throw new CantRunException("Could not retrieve the output directory");
}
// Build and run
String execName = outputPath.concat("/").concat(rustConfiguration.getName());
if (execName.endsWith(".rs")) {
execName = execName.substring(0, execName.length() - 3);
}
if (SystemInfo.isWindows) {
execName = execName.concat(".exe");
}
// Now run the build
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(execName);
commandLine.addParameters(params.getProgramParametersList().getParameters());
commandLine.getEnvironment().putAll(params.getEnv());
commandLine.setWorkDirectory(params.getWorkingDirectory());
return RustProcessHandler.runCommandLine(commandLine);
}