diff --git a/src/main/java/com/google/devtools/build/lib/vfs/PathFragment.java b/src/main/java/com/google/devtools/build/lib/vfs/PathFragment.java index 35575af65bd53c..c899720419e81e 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/PathFragment.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/PathFragment.java @@ -420,7 +420,7 @@ public int compareTo(PathFragment o) { //////////////////////////////////////////////////////////////////////// /** - * Returns the number of segments in this path. + * Returns the number of segments in this path, excluding the drive string for absolute paths. * *
This operation is O(N) on the length of the string.
*/
@@ -500,6 +500,10 @@ public String getSegment(int index) {
* . Thus the number of segments in the new PathFragment is endIndex - beginIndex
*
.
*
+ *
If the path is absolute and This operation is O(N) on the length of the string.
*
* @param beginIndex the beginning index, inclusive.
@@ -556,7 +560,7 @@ private PathFragment subFragmentImpl(int beginIndex, int endIndex) {
throw new IndexOutOfBoundsException(
String.format("path: %s, beginIndex: %d endIndex: %d", toString(), beginIndex, endIndex));
}
- // If beginIndex is 0 we include the drive. Very odd semantics.
+ // If beginIndex is 0, we include the drive string.
int driveStrLength = 0;
if (beginIndex == 0) {
starti = 0;
beginIndex
is zero, the returned path is absolute.
+ * Otherwise, if the path is relative or beginIndex> is greater than zero, the returned path
+ * is relative.
+ *
*