(from, to, stringEqualityComparer, getCanonicalFileName)
| 8150 | ts.startsWithDirectory = startsWithDirectory; |
| 8151 | //// Relative Paths |
| 8152 | function getPathComponentsRelativeTo(from, to, stringEqualityComparer, getCanonicalFileName) { |
| 8153 | var fromComponents = reducePathComponents(getPathComponents(from)); |
| 8154 | var toComponents = reducePathComponents(getPathComponents(to)); |
| 8155 | var start; |
| 8156 | for (start = 0; start < fromComponents.length && start < toComponents.length; start++) { |
| 8157 | var fromComponent = getCanonicalFileName(fromComponents[start]); |
| 8158 | var toComponent = getCanonicalFileName(toComponents[start]); |
| 8159 | var comparer = start === 0 ? ts.equateStringsCaseInsensitive : stringEqualityComparer; |
| 8160 | if (!comparer(fromComponent, toComponent)) |
| 8161 | break; |
| 8162 | } |
| 8163 | if (start === 0) { |
| 8164 | return toComponents; |
| 8165 | } |
| 8166 | var components = toComponents.slice(start); |
| 8167 | var relative = []; |
| 8168 | for (; start < fromComponents.length; start++) { |
| 8169 | relative.push(".."); |
| 8170 | } |
| 8171 | return __spreadArray(__spreadArray([""], relative, true), components, true); |
| 8172 | } |
| 8173 | ts.getPathComponentsRelativeTo = getPathComponentsRelativeTo; |
| 8174 | function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) { |
| 8175 | ts.Debug.assert((getRootLength(fromDirectory) > 0) === (getRootLength(to) > 0), "Paths must either both be absolute or both be relative"); |
no test coverage detected
searching dependent graphs…