in aws-core-common/src/main/java/jetbrains/buildServer/util/PathMappings.java [44:73]
public String mapPath(@NotNull File f) {
String relativePath = FileUtil.getRelativePath(myBaseDir, f);
if (relativePath == null) return null;
relativePath = FileUtil.toSystemIndependentName(relativePath);
String result = null;
for (Map.Entry<String, String> m : myPathMappings.entrySet()) {
if (m.getKey().startsWith("-:")) continue;
final String from = m.getKey().startsWith("+:") ? m.getKey().substring(2) : m.getKey();
if (relativePath.equals(from)) return doMap(f.getName(), m.getValue());
if (relativePath.startsWith(from)) {
result = doMap(relativePath.substring(StringUtil.commonPrefix(relativePath, from).length()), m.getValue());
continue;
}
if (isWildcard(from) && matches(from, f)) {
final String withoutWildcards = removeWildcards(from);
result = doMap(
StringUtil.isEmpty(withoutWildcards) ?
relativePath :
relativePath.substring(relativePath.lastIndexOf(withoutWildcards) + withoutWildcards.length()),
m.getValue());
}
}
return result == null ? relativePath : result;
}