added fix and a test for order independence of nested prefixing

Signed-off-by: VoR0220 <rj@erisindustries.com>
This commit is contained in:
VoR0220
2017-01-11 11:45:14 -06:00
parent 4585bfdce7
commit 4542f459f1
2 changed files with 20 additions and 2 deletions
+2 -2
View File
@@ -523,7 +523,7 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context
if (!isPrefixOf(context, _context))
continue;
// Skip if we already have a closer prefix match.
if (prefix.length() < longestPrefix)
if (prefix.length() < longestPrefix && context.length() == longestContext)
continue;
// Skip if the prefix does not match.
if (!isPrefixOf(prefix, _path))
@@ -534,7 +534,7 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context
bestMatchTarget = redir.target;
}
string path = longestPrefixTarget;
string path = bestMatchTarget;
path.append(_path.begin() + longestPrefix, _path.end());
return path;
}