16 std::string i_resolve( std::string& source,
int recursions ) {
17 if ( recursions > 0 ) {
18 int lvl = 0, mx_lvl = 0;
19 for (
const char *
c = source.c_str(), *beg =
nullptr; *
c != 0; ++
c ) {
22 if ( *(
c + 1 ) ==
'{' ) {
32 if ( lvl == mx_lvl ) {
33 std::string env( beg + 2,
c - beg - 2 );
35 if ( !
System::getEnv( env.c_str(), rep ) ) rep = i_resolve( env, --recursions );
37 std::string e( beg,
c - beg + 1 );
38 size_t idx = std::string::npos;
39 while ( ( idx = source.find( e ) ) != std::string::npos ) { source.replace( idx, e.length(), rep ); }
40 return i_resolve( source, --recursions );
58 std::string source = var;
59 res = i_resolve( source, recursions );
66 std::string home_dir =
"./";