| 73 | static constexpr auto KEY_DEBUG_SERVER = "debugServer"; |
| 74 | |
| 75 | static void replaceExecutableArgs( std::string& arg ) { |
| 76 | LuaPattern ptrn( "%$%b()" ); |
| 77 | PatternMatcher::Range match[4]; |
| 78 | while ( ptrn.matches( arg, match ) ) { |
| 79 | auto cmd = arg.substr( match[0].start, match[0].end - match[0].start ); |
| 80 | if ( cmd.size() > 3 ) { |
| 81 | auto rcmd = cmd.substr( 2, cmd.size() - 3 ); |
| 82 | std::string out; |
| 83 | Process p; |
| 84 | if ( p.create( rcmd ) ) { |
| 85 | p.readAllStdOut( out ); |
| 86 | String::trimInPlace( out, '\n' ); |
| 87 | String::trimInPlace( out, '\t' ); |
| 88 | String::replaceAll( arg, cmd, out ); |
| 89 | } |
| 90 | } |
| 91 | }; |
| 92 | } |
| 93 | |
| 94 | static bool replaceEnvVars( std::string& arg, PluginContextProvider* ctx ) { |
| 95 | PatternMatcher::Range match[4]; |