truncate resource path cross platformly