cmStateDirectory: Clarify relative path top selection logic

Re-implement the same algorithm using direct iteration without
collecting a vector first.
1 file changed