def get_relative_path_to_pack(pack_ref, file_path):
 pack_base_path = get_pack_base_path(pack_name=pack_ref)
 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

def get_relative_path_to_pack ( pack_ref , file_path ) : pack_base_path = get_pack_base_path ( pack_name = pack_ref ) 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 .