comparison src/main.in.cc @ 21284:1bbd799ac7c7 stable

Invoke correct version of octave-cli from main driver program * main.in.cc (main): Refactor construction of binary filenames, ensure versioned octave-cli binary is called for --no-gui-libs.
author Mike Miller <mtmiller@octave.org>
date Wed, 17 Feb 2016 01:21:19 -0800
parents 19755f4fc851
children 2c93596507fe
comparison
equal deleted inserted replaced
21263:8990b8c4f00a 21284:1bbd799ac7c7
430 bool start_gui = true; 430 bool start_gui = true;
431 bool gui_libs = true; 431 bool gui_libs = true;
432 432
433 std::string octave_bindir = get_octave_bindir (); 433 std::string octave_bindir = get_octave_bindir ();
434 std::string octave_archlibdir = get_octave_archlibdir (); 434 std::string octave_archlibdir = get_octave_archlibdir ();
435 std::string octave_cli
436 = octave_bindir + dir_sep_char + "octave-cli-" OCTAVE_VERSION;
437 std::string octave_gui = octave_archlibdir + dir_sep_char + "octave-gui";
435 438
436 #if defined (HAVE_OCTAVE_GUI) 439 #if defined (HAVE_OCTAVE_GUI)
437 // The Octave version number is already embedded in the 440 // The Octave version number is already embedded in the
438 // octave_archlibdir directory name so we don't need to append it to 441 // octave_archlibdir directory name so we don't need to append it to
439 // the octave-gui file name. 442 // the octave-gui file name.
440 443
441 std::string file = octave_archlibdir + dir_sep_char + "octave-gui"; 444 std::string file = octave_gui;
442 #else 445 #else
443 std::string file 446 std::string file = octave_cli;
444 = octave_bindir + dir_sep_char + "octave-cli-" OCTAVE_VERSION;
445 #endif 447 #endif
446 448
447 char **new_argv = new char * [argc + 1]; 449 char **new_argv = new char * [argc + 1];
448 450
449 int k = 1; 451 int k = 1;
460 // require less memory. Don't pass the --no-gui-libs option 462 // require less memory. Don't pass the --no-gui-libs option
461 // on as that option is not recognized by Octave. 463 // on as that option is not recognized by Octave.
462 464
463 start_gui = false; 465 start_gui = false;
464 gui_libs = false; 466 gui_libs = false;
465 file = octave_bindir + dir_sep_char + "octave-cli"; 467 file = octave_cli;
466 } 468 }
467 else if (! strcmp (argv[i], "--no-gui")) 469 else if (! strcmp (argv[i], "--no-gui"))
468 { 470 {
469 // If we see this option, then we can just exec octave; we 471 // If we see this option, then we can just exec octave; we
470 // don't have to create a child process and wait for it to 472 // don't have to create a child process and wait for it to
496 if (! dpy_avail) 498 if (! dpy_avail)
497 { 499 {
498 start_gui = false; 500 start_gui = false;
499 gui_libs = false; 501 gui_libs = false;
500 502
501 file = octave_bindir + dir_sep_char + "octave-cli-" OCTAVE_VERSION; 503 file = octave_cli;
502 504
503 if (warn_display) 505 if (warn_display)
504 { 506 {
505 if (! display_check_err_msg) 507 if (! display_check_err_msg)
506 display_check_err_msg = "graphical display unavailable"; 508 display_check_err_msg = "graphical display unavailable";