protected function guess_maxima_command($path)
 {
     if ('default' == stack_connection_helper::get_maximaversion()) {
         throw new stack_exception("stack_cas_connection: maxima cannot be set to default on Windows platform. " . "Please choose an explicit version via the administration settings page.");
     }
     $cmd = $path . '/maxima.bat';
     if (!is_readable($cmd)) {
         throw new stack_exception("stack_cas_connection: maxima launch script {$cmd} does not exist.");
     }
     return $cmd;
 }
 protected function guess_maxima_command($path)
 {
     global $CFG;
     if (stack_connection_helper::get_platform() == 'unix-optimised') {
         // We are trying to use a Lisp snapshot of Maxima with all the
         // STACK libraries loaded.
         $lispimage = $CFG->dataroot . '/stack/maxima-optimised';
         if (is_readable($lispimage)) {
             return $lispimage;
         }
     }
     if (is_readable('/Applications/Maxima.app/Contents/Resources/maxima.sh')) {
         // This is the path on Macs, if Maxima has been installed following
         // the instructions on Sourceforge.
         return '/Applications/Maxima.app/Contents/Resources/maxima.sh';
     }
     // Default guess on Linux, making explicit use of the chosen version number.
     $maximaversion = stack_connection_helper::get_maximaversion();
     $maximacommand = 'maxima';
     if ('default' != $maximaversion) {
         $maximacommand = 'maxima --use-version=' . $maximaversion;
     }
     return $maximacommand;
 }