Find path depth in platform-agnostic manner