| 44 | static unsigned char pathMappingStorage[sizeof(unordered_map<string, string>)]; |
| 45 | |
| 46 | static void populatePathMapping(const char *pathMappingStr) |
| 47 | { |
| 48 | pathMapping->clear(); |
| 49 | |
| 50 | if (!pathMappingStr) { |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | stringstream ss(pathMappingStr); |
| 55 | string token; |
| 56 | |
| 57 | // Expected format: "old1:new1;old2:new2;..." |
| 58 | while (std::getline(ss, token, ';')) { |
| 59 | if (token.empty()) { |
| 60 | continue; |
| 61 | } |
| 62 | std::string::size_type colonIdx = token.find(':'); |
| 63 | JASSERT(colonIdx != std::string::npos)(token).Text("Bad mapping; expect old:new"); |
| 64 | string oldPath = token.substr(0, colonIdx); |
| 65 | string newPath = token.substr(colonIdx + 1); |
| 66 | JASSERT(!oldPath.empty()); |
| 67 | JASSERT(!newPath.empty()); |
| 68 | (*pathMapping)[oldPath] = newPath; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | static void pathTranslator_Init() |
| 73 | { |
no test coverage detected