Looking at this code a bit more closely now, I think that this is the wrong comparison to make.

The `fsRoot` property is only a property of the CDVLocalFilesystem class, not CDVFilesystem. It is at least possible for other CDVFilesystem subclasses to implement `URLforFilesystemPath:` without having an `fsRoot` property, and in those cases, this code would throw an exception.

Maybe a better way to do this is to keep track of the `fullPath` property of the `url` variable (which *will* be present on any CDVFilesystemURL). That property will be shorter in all of the cases where `fsRoot` would be longer, so a shorter `fullPath` would imply that the filesystem is a better match for the local path.

What do you think of changing `index` into something like `shortestFullPath`, and testing whether

    [[url fullPath] length] < shortestFullPath

?