util: handle relative paths in get_path_component