|
12 | 12 | */ |
13 | 13 | package ts.eclipse.ide.internal.ui.wizards; |
14 | 14 |
|
| 15 | +import java.io.File; |
15 | 16 | import java.lang.reflect.InvocationTargetException; |
16 | 17 | import java.nio.charset.StandardCharsets; |
17 | 18 | import java.util.ArrayList; |
|
52 | 53 | import ts.eclipse.ide.core.utils.TypeScriptResourceUtil; |
53 | 54 | import ts.eclipse.ide.internal.ui.TypeScriptUIMessages; |
54 | 55 | import ts.eclipse.ide.terminal.interpreter.CommandTerminalService; |
| 56 | +import ts.eclipse.ide.terminal.interpreter.EnvPath; |
55 | 57 | import ts.eclipse.ide.terminal.interpreter.LineCommand; |
56 | 58 | import ts.eclipse.ide.ui.TypeScriptUIImageResource; |
57 | 59 | import ts.eclipse.ide.ui.wizards.AbstractNewProjectWizard; |
58 | 60 | import ts.npm.NpmConstants; |
59 | 61 | import ts.npm.PackageJson; |
60 | 62 | import ts.resources.jsonconfig.TsconfigJson; |
| 63 | +import ts.utils.FileUtils; |
61 | 64 | import ts.utils.IOUtils; |
| 65 | +import ts.utils.StringUtils; |
62 | 66 |
|
63 | 67 | /** |
64 | 68 | * Standard workbench wizard that creates a new TypeScript project resource in |
@@ -193,6 +197,12 @@ public void run(final IProgressMonitor monitor) throws InvocationTargetException |
193 | 197 | properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, |
194 | 198 | "org.eclipse.tm.terminal.connector.local.LocalConnector"); |
195 | 199 |
|
| 200 | + // Prepare environnement Path: |
| 201 | + // - add nodejs directory |
| 202 | + String nodeFilePath = getNodeFilePath(); |
| 203 | + if (!StringUtils.isEmpty(nodeFilePath)) { |
| 204 | + EnvPath.insertToEnvPath(properties, nodeFilePath); |
| 205 | + } |
196 | 206 | CommandTerminalService.getInstance().executeCommand(commands, terminalId, properties, null); |
197 | 207 |
|
198 | 208 | } |
@@ -224,6 +234,11 @@ public void run() { |
224 | 234 | }); |
225 | 235 |
|
226 | 236 | } |
| 237 | + |
| 238 | + private String getNodeFilePath() { |
| 239 | + File nodeFile = TypeScriptResourceUtil.getWorkspaceNodejsInstallPath(); |
| 240 | + return nodeFile != null ? FileUtils.getPath(nodeFile) : null; |
| 241 | + } |
227 | 242 | }; |
228 | 243 | } |
229 | 244 |
|
|
0 commit comments