Skip to content

Commit

Permalink
JBIDE-20989: Fixing node preference validation for node64.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuziuk authored and alexeykazakov committed Dec 7, 2015
1 parent a8fbc18 commit 80b09a2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private BowerConstants() {
public static final String BOWER_COMPONENTS = "bower_components"; //$NON-NLS-1$
public static final String BOWER_JSON = "bower.json"; //$NON-NLS-1$
public static final String NODE = "node"; //$NON-NLS-1$
public static final String NODE_64_EXE = "node64.exe"; //$NON-NLS-1$
public static final String NODE_EXE = "node.exe"; //$NON-NLS-1$
public static final String NODE_JS = "nodejs"; //$NON-NLS-1$
public static final String NODE_MODULES = "node_modules"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,21 @@ protected boolean doCheckState() {
File nodeExecutable = new File(selectedFile, nodeExecutableName);
if (!nodeExecutable.exists()) {

if (!PlatformUtil.isLinux()) {
if (PlatformUtil.isMacOS()) {
setErrorMessage(Messages.BowerPreferencePage_NotValidNodeError);
return false;
}
return false;
}

// JBIDE-20351 Bower tooling doesn't detect node when the binary is called 'nodejs'
// If "nodejs" is not detected try to detect "node"
nodeExecutableName = BowerConstants.NODE;
if (PlatformUtil.isLinux()) {
nodeExecutableName = BowerConstants.NODE;

//JBIDE-20988 Preference validation fails on windows if node executable called node64.exe
} else if (PlatformUtil.isWindows()) {
nodeExecutableName = BowerConstants.NODE_64_EXE;
}

nodeExecutable = new File(selectedFile, nodeExecutableName);
if (!nodeExecutable.exists()) {
setErrorMessage(Messages.BowerPreferencePage_NotValidNodeError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,21 @@ public static String getNodeExecutableLocation() {
String nodeExecutableLocation = null;
String nodeExecutableName = getNodeExecutableName();
File nodeExecutable = new File(BowerPreferenceHolder.getNodeLocation(), nodeExecutableName);

if (nodeExecutable.exists()) {
nodeExecutableLocation = nodeExecutable.getAbsolutePath();
} else if (PlatformUtil.isLinux()) {
} else if (!PlatformUtil.isMacOS()) {

// JBIDE-20351 Bower tooling doesn't detect node when the binary is called 'nodejs'
// If "nodejs" is not detected try to detect "node"
nodeExecutableName = BowerConstants.NODE;
if (PlatformUtil.isLinux()) {
nodeExecutableName = BowerConstants.NODE;

//JBIDE-20988 Preference validation fails on windows if node executable called node64.exe
} else if (PlatformUtil.isWindows()) {
nodeExecutableName = BowerConstants.NODE_64_EXE;
}

nodeExecutable = new File(BowerPreferenceHolder.getNodeLocation(), nodeExecutableName);
if (nodeExecutable.exists()) {
nodeExecutableLocation = nodeExecutable.getAbsolutePath();
Expand Down

0 comments on commit 80b09a2

Please sign in to comment.