in command.line/java/com/jetbrains/teamcity/resources/TCWorkspace.java [71:108]
public ITCResource getTCResource(@NotNull File local) throws IllegalArgumentException {
try {
local = local.getAbsoluteFile().getCanonicalFile();
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
ITCResourceMatcher matcher;
// set to OverridingMatcher if defined
if (myOverridingMatcher != null) {
matcher = myOverridingMatcher;
} else {
// look into cache(cache keep file for files resides in same folder only)
matcher = myCache.get(local.getParentFile());
if (matcher == null) {
// seek for uncached
matcher = getMatcherFor(local);
if (matcher == null) {
// look into Global
matcher = myGlobalMatcher;
if (myGlobalMatcher == null) {
Debug.getInstance().debug(TCWorkspace.class, MessageFormat.format("Neither Local nor Global admin files found for \"{0}\"", local));
return null;
}
}
}
}
// cache found
myCache.put(local.getParentFile(), matcher);
final ITCResourceMatcher.Matching matching = matcher.getMatching(local);
if (matching == null) {
Debug.getInstance().debug(TCWorkspace.class, MessageFormat.format("No Matching found for \"{0}\"", local));
return null;
}
// All found
final String prefix = matching.getTCID();
final String relativePath = matching.getRelativePath();
return new TCResource(local, MessageFormat.format("{0}/{1}", prefix, relativePath)); //$NON-NLS-1$
}