Mercurial > octave-nkf
changeset 19683:830c8457295a
Check for gnuplot binary with executable file extension if needed
* __init_gnuplot__.cc (have_gnuplot_binary): Check for gnuplot binary with
the executable file extension added if it's defined.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Sun, 01 Feb 2015 22:15:34 -0500 |
parents | 16f21db320b5 |
children | 50f14692e33b |
files | libinterp/dldfcn/__init_gnuplot__.cc |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_gnuplot__.cc Sat Jan 31 18:41:45 2015 -0500 +++ b/libinterp/dldfcn/__init_gnuplot__.cc Sun Feb 01 22:15:34 2015 -0500 @@ -38,6 +38,7 @@ #include "error.h" #include "file-stat.h" #include "graphics.h" +#include "oct-conf.h" #include "oct-env.h" #include "parse.h" #include "utils.h" @@ -172,16 +173,26 @@ static bool have_gnuplot_binary (void) { + const std::string exeext = std::string (OCTAVE_CONF_EXEEXT); + const std::string path = octave_env::getenv ("PATH"); + octave_value_list tmp = feval ("gnuplot_binary", octave_value_list ()); std::string gnuplot_binary = tmp(0).string_value (); - std::string path = octave_env::getenv ("PATH"); - string_vector args (gnuplot_binary); std::string gnuplot_path = search_path_for_file (path, args); file_stat fs (gnuplot_path); + if (! fs.exists () && ! exeext.empty ()) + { + args[0] += exeext; + + gnuplot_path = search_path_for_file (path, args); + + fs = file_stat (gnuplot_path); + } + return fs.exists (); }