@@ -41,20 +41,28 @@ public static void addMatlabToEnvPathFromAxis(Computer cmp, TaskListener listene
4141 return ;
4242 }
4343
44+ FilePath matlabRoot = getNodeSpecificHome (name ,
45+ cmp .getNode (), listener , env );
46+
47+ if (matlabRoot != null && matlabRoot .getParent ().exists ()){
48+ env .put ("PATH+matlab_batch" , matlabRoot .getParent ().getRemote ());
49+ }
50+
4451 String matlabExecutablePath = getNodeSpecificHome (name ,
45- cmp .getNode (), listener , env ) + ((Boolean .TRUE .equals (cmp .isUnix ()))?"/bin" : "\\ bin" );
52+ cmp .getNode (), listener , env ). getRemote () + ((Boolean .TRUE .equals (cmp .isUnix ()))?"/bin" : "\\ bin" );
4653 env .put ("PATH+matlabroot" , matlabExecutablePath );
4754
55+
4856 // Specify which MATLAB was added to path.
4957 listener .getLogger ().println ("\n " + String .format (Message .getValue ("matlab.added.to.path.from" ), matlabExecutablePath ) + "\n " );
5058 }
5159
52- public static String getNodeSpecificHome (String instName ,Node node , TaskListener listener , EnvVars env )
60+ public static FilePath getNodeSpecificHome (String instName ,Node node , TaskListener listener , EnvVars env )
5361 throws IOException , InterruptedException {
5462 MatlabInstallation inst = MatlabInstallation .getInstallation (instName );
5563 if (inst == null || node == null ) {
5664 // Following will error out in BuildWrapper
57- return "" ;
65+ throw new MatlabNotFoundError ( "MATLAB installations could not be found" ) ;
5866 }
5967
6068 // get installation for node and environment.
@@ -66,6 +74,6 @@ public static String getNodeSpecificHome(String instName,Node node, TaskListener
6674 throw new MatlabNotFoundError (String .format (Message .getValue ("matlab.not.found.error.for.node" ), instName , Objects
6775 .requireNonNull (node ).getDisplayName ()));
6876 }
69- return matlabExecutablePath . getRemote () ;
77+ return matlabExecutablePath ;
7078 }
7179}
0 commit comments