Skip to content
Snippets Groups Projects
Unverified Commit 4e8680e2 authored by Tomáš Pecka's avatar Tomáš Pecka
Browse files

aql: Simplify HOME env var handling

parent 2801032e
No related branches found
No related tags found
1 merge request!209Support for aql library and aqlrc
...@@ -97,10 +97,14 @@ int main ( int argc, char * argv[] ) { ...@@ -97,10 +97,14 @@ int main ( int argc, char * argv[] ) {
exceptions.push_back ( exception.error ( ) ); exceptions.push_back ( exception.error ( ) );
} ); } );
   
const char* envHome = std::getenv ( "HOME" ); std::optional < std::filesystem::path > envHomePath;
if ( auto *env = std::getenv ( "HOME" ) ) {
envHomePath = std::string ( env );
}
std::unique_ptr < ReadlinePromptHistory > historyHandler; std::unique_ptr < ReadlinePromptHistory > historyHandler;
if ( envHome != nullptr ) { if ( envHomePath ) {
historyHandler = std::make_unique < ReadlinePromptHistory > ( std::string ( envHome ) + "/.aql_history" ); historyHandler = std::make_unique < ReadlinePromptHistory > ( envHomePath.value ( ) / ".aql_history" );
} }
   
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment