From cf8501337b099be85afd0856cbeb60cf8da4c3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 24 Sep 2023 01:45:43 -0300 Subject: [PATCH] Nit. --- src/tools/ecode/ecode.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 50a43bcdf..aea670750 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -3266,7 +3266,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe // that the environment is more friendly for any new user std::string path( Sys::getEnv( "PATH" ) ); std::string shellPath( getShellEnv( "PATH", mConfig.term.shell ) ); - if ( String::hash( path ) != String::hash( shellPath ) ) { + if ( !shellPath.empty() && String::hash( path ) != String::hash( shellPath ) ) { auto pathSpl = String::split( path, ':' ); auto shellPathSpl = String::split( shellPath, ':' ); std::vector paths; @@ -3276,8 +3276,10 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe if ( std::find( paths.begin(), paths.end(), shellPath ) == paths.end() ) paths.emplace_back( std::move( shellPath ) ); } - std::string newPath = String::join( paths, ':' ); - setenv( "PATH", newPath.c_str(), 1 ); + if ( pathSpl.size() != paths.size() ) { + std::string newPath = String::join( paths, ':' ); + setenv( "PATH", newPath.c_str(), 1 ); + } } } ); #endif