| 1111 | } |
| 1112 | |
| 1113 | inline void replacePropertiesBlock(const std::string& infoFilePath, const std::string& replacement) |
| 1114 | { |
| 1115 | auto contents = algorithm::loadFileToString(infoFilePath); |
| 1116 | |
| 1117 | std::list<std::string> lines; |
| 1118 | string::split(lines, contents, "\n\r"); |
| 1119 | |
| 1120 | contents.clear(); |
| 1121 | for (auto line = lines.begin(); line != lines.end(); ++line) |
| 1122 | { |
| 1123 | if (string::trim_copy(*line) == "LayerProperties") |
| 1124 | { |
| 1125 | ++line; // skip LayerProperties |
| 1126 | ++line; // skip the opening brace |
| 1127 | |
| 1128 | while (string::trim_copy(*line) != "}") |
| 1129 | { |
| 1130 | ++line; |
| 1131 | } |
| 1132 | |
| 1133 | // Add the replacement block here |
| 1134 | contents.append(replacement); |
| 1135 | contents.append("\n"); |
| 1136 | continue; |
| 1137 | } |
| 1138 | |
| 1139 | contents.append(*line); |
| 1140 | contents.append("\n"); |
| 1141 | } |
| 1142 | |
| 1143 | algorithm::replaceFileContents(infoFilePath, contents); |
| 1144 | } |
| 1145 | |
| 1146 | TEST_F(LayerTest, ParseEmptyLayerPropertiesBlock) |
| 1147 | { |
no test coverage detected