Community
Participate
Working Groups
Path.isPrefixOf() returns false for "/" and "c:/temp/e-in-e" but the spec says that the root is the prefix for all paths. Note that both of the above paths correctly return "true" for isAbsolute().
Problem looks like it is in the first couple of lines where it compares the devices for the path. If one path has a device and the other doesn't, it incorrectly returns false.
Have determined that the spec needs to be re-worded to be more precise, rather than a code change. Therefore the root path is not a prefix of any path which has a device.
I have updated and released changes to the wording in the API. Old wording: "Modulo device ids, an empty path is a prefix of all paths; a root path is a prefix of all absolute paths." New wording: "An empty path is a prefix of all paths with the same device; a root path is a prefix of all absolute paths with the same device."