PathMappings don't work on windows with ':' as seperator

This commit is contained in:
sysRay 2019-03-21 15:02:07 +01:00
parent b7d9ced086
commit b42c959373

View File

@ -20,6 +20,13 @@ Config *g_config;
void DoPathMapping(std::string &arg) { void DoPathMapping(std::string &arg) {
for (const std::string &mapping : g_config->clang.pathMappings) { for (const std::string &mapping : g_config->clang.pathMappings) {
auto colon = mapping.find('>');
if (colon != std::string::npos) {
auto p = arg.find(mapping.substr(0, colon));
if (p != std::string::npos)
arg.replace(p, colon, mapping.substr(colon + 1));
} else {
// Deprecated: Use only for older settings
auto colon = mapping.find(':'); auto colon = mapping.find(':');
if (colon != std::string::npos) { if (colon != std::string::npos) {
auto p = arg.find(mapping.substr(0, colon)); auto p = arg.find(mapping.substr(0, colon));
@ -27,5 +34,6 @@ void DoPathMapping(std::string &arg) {
arg.replace(p, colon, mapping.substr(colon + 1)); arg.replace(p, colon, mapping.substr(colon + 1));
} }
} }
}
} }
} }