From 15a8bc9f3edbec96e5d2ac899e20079b1d991202 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 Mar 2019 13:39:55 +0100 Subject: [PATCH] Fix PATH reading --- src/tests/common-files/gnuplot_i.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 7683dcba0..2f5d7d979 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -2082,7 +2082,7 @@ bool Gnuplot::get_program_path() // Retrieves a C string containing the value of environment variable PATH path = std::getenv("PATH"); std::stringstream s; - if (!path) + if (path != nullptr) { s << path; } @@ -2091,10 +2091,8 @@ bool Gnuplot::get_program_path() throw GnuplotException("PATH is not well defined"); } std::string path_str; - if (s.gcount() > 0) - { - path_str = s.str(); - } + path_str = s.str(); + std::list ls; //split path (one long string) into list ls of strings