Intelligently truncate path