parse path up to ~