Bug fix to category selection by parent directory.

Introducted in df58f307629310fc16f9f62d72e11400474067ec.

commonprefix is not reliable test for a subdirectory, as (e.g.) test and
test1 share the same prefix ('test') but test1 is not a subdirectory.
Instead, check if the relative path between two directories begins with
the parent directory (i.e. '..').  This correctly distinguishes between the cases test and test1 and test and test/test1.