def get_relative_path_to_pack(pack_name, file_path):
    pack_base_path = get_pack_base_path(pack_name=pack_name)

    if not os.path.isabs(file_path):
        return file_path

    common_prefix = os.path.commonprefix([pack_base_path, file_path])
    if common_prefix != pack_base_path:
        raise ValueError('file_path is not located inside the pack directory')

    relative_path = os.path.relpath(file_path, common_prefix)
    return relative_path
Retrieve a file path which is relative to the provided pack directory.
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/content/utils.py/get_relative_path_to_pack