| 15 | } |
| 16 | |
| 17 | static bool replaceInFile( const std::string& path, const std::string& replaceText, |
| 18 | const std::vector<std::pair<Int64, Int64>>& replacements ) { |
| 19 | std::string data; |
| 20 | if ( !FileSystem::fileGet( path, data ) ) |
| 21 | return false; |
| 22 | |
| 23 | Int64 diff = 0; |
| 24 | |
| 25 | for ( const auto& range : replacements ) { |
| 26 | data.replace( range.first + diff, range.second - range.first, replaceText ); |
| 27 | diff += replaceText.size() - ( range.second - range.first ); |
| 28 | } |
| 29 | |
| 30 | if ( !FileSystem::fileWrite( path, (const Uint8*)data.c_str(), data.size() ) ) |
| 31 | return false; |
| 32 | |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | static bool replaceInFile( const std::string& path, const std::vector<std::string>& replaceTexts, |
| 37 | const std::vector<std::pair<Int64, Int64>>& replacements ) { |
no test coverage detected