Skip to content

Commit

Permalink
Merge pull request #204 from mathworks/gecko_g2630833
Browse files Browse the repository at this point in the history
Fix for MATLAB root path displayed in Jenkins build logs.
  • Loading branch information
abhargav-mw authored Dec 1, 2021
2 parents fab4660 + 0c12d73 commit 79de63c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher
setEnv(initialEnvironment);

FilePath matlabExecutablePath = new FilePath(launcher.getChannel(),
getNodeSpecificMatlab(Computer.currentComputer(), listener) + "/bin/" + getNodeSpecificExecutable(launcher));
getNodeSpecificMatlab(Computer.currentComputer(), listener) + getNodeSpecificExecutable(launcher));

if (!matlabExecutablePath.exists()) {
throw new MatlabNotFoundError(Message.getValue("matlab.not.found.error"));
Expand All @@ -196,6 +196,6 @@ public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher
}

private String getNodeSpecificExecutable(Launcher launcher) {
return (launcher.isUnix()) ? "matlab" : "matlab.exe";
return (launcher.isUnix()) ? "/bin/matlab" : "\\bin\\matlab.exe";
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/mathworks/ci/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public static void addMatlabToEnvPathFrmAxis(Computer cmp, TaskListener listener
}

String matlabExecutablePath = getNodeSpecificHome(name,
cmp.getNode(), listener, env) + "/bin";
cmp.getNode(), listener, env) + ((Boolean.TRUE.equals(cmp.isUnix()))?"/bin" : "\\bin");
env.put("PATH+matlabroot", matlabExecutablePath);

// Specify which MATLAB was added to path.
listener.getLogger().println("\n" + String.format(Message.getValue("matlab.added.to.path.from"), matlabExecutablePath) + "\n");
}
Expand Down

0 comments on commit 79de63c

Please sign in to comment.