Skip to content

Commit 02456a1

Browse files
authored
Merge pull request #444 from vrubezhny/jbds4132-master
JBDS-4132 Could not load nodeJSInstall: node-v0.10.22-linux-x86_64 (master)
2 parents 1644e96 + 8db2e91 commit 02456a1

File tree

1 file changed

+26
-15
lines changed
  • eclipse/tern.eclipse.ide.server.nodejs.core/src/tern/eclipse/ide/server/nodejs/internal/core

1 file changed

+26
-15
lines changed

eclipse/tern.eclipse.ide.server.nodejs.core/src/tern/eclipse/ide/server/nodejs/internal/core/NodejsInstall.java

+26-15
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@
1414
import java.io.File;
1515
import java.io.IOException;
1616

17+
import org.eclipse.core.internal.runtime.InternalPlatform;
1718
import org.eclipse.core.runtime.CoreException;
1819
import org.eclipse.core.runtime.FileLocator;
1920
import org.eclipse.core.runtime.IConfigurationElement;
21+
import org.eclipse.core.runtime.IPath;
2022
import org.eclipse.core.runtime.Platform;
2123

2224
import tern.eclipse.ide.server.nodejs.core.INodejsInstall;
2325
import tern.eclipse.ide.server.nodejs.core.INodejsInstallProvider;
2426
import tern.utils.ZipUtils;
2527

28+
@SuppressWarnings("restriction")
2629
public class NodejsInstall implements INodejsInstall {
2730

2831
private String id;
@@ -56,23 +59,31 @@ private void createClass(IConfigurationElement element) throws IOException {
5659
String pluginId = element.getNamespaceIdentifier();
5760
String path = element.getAttribute("path");
5861
if (path != null && path.length() > 0) {
59-
File baseDir = FileLocator.getBundleFile(Platform
62+
File bundleDir = FileLocator.getBundleFile(Platform
6063
.getBundle(pluginId));
61-
this.path = new File(baseDir, path);
62-
63-
// check if path exists, if it doesn't look for zip
64-
if (!this.path.exists()) {
65-
String zip = element.getAttribute("zip");
66-
67-
File zipFile = new File(baseDir, zip);
68-
69-
if (zipFile.exists()) {
70-
if (zipFile.getName().toLowerCase().endsWith(".zip")) {
71-
ZipUtils.extract(zipFile, baseDir);
72-
}
64+
65+
IPath stateLocationPath = InternalPlatform.getDefault().getStateLocation(Platform
66+
.getBundle(pluginId));
67+
68+
if (stateLocationPath != null) {
69+
File baseDir = stateLocationPath.toFile();
7370

74-
if(this.path.exists()) {
75-
this.path.setExecutable(true);
71+
this.path = new File(baseDir, path);
72+
73+
// check if path exists, if it doesn't look for zip
74+
if (!this.path.exists()) {
75+
String zip = element.getAttribute("zip");
76+
77+
File zipFile = new File(bundleDir, zip);
78+
79+
if (zipFile.exists()) {
80+
if (zipFile.getName().toLowerCase().endsWith(".zip")) {
81+
ZipUtils.extract(zipFile, baseDir);
82+
}
83+
84+
if(this.path.exists()) {
85+
this.path.setExecutable(true);
86+
}
7687
}
7788
}
7889
}

0 commit comments

Comments
 (0)