cleanpath: process paths starting with "~user/" properly