From b894fa61989ea5150dedb1b21857246ba7a08a98 Mon Sep 17 00:00:00 2001 From: Boleyn Su Date: Sat, 13 May 2023 19:04:55 +0800 Subject: [PATCH] skylib: Improve path.bzl%runfile to better integrate with runfiles library --- skylib/path.bzl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skylib/path.bzl b/skylib/path.bzl index 0e33e6a52..2357bcbd3 100644 --- a/skylib/path.bzl +++ b/skylib/path.bzl @@ -87,6 +87,10 @@ def strip_prefix(path, prefix): def runfile(ctx, f): """Return the runfiles relative path of f.""" + if f.short_path[:3] == "../": + return f.short_path[3:] + if f.owner and f.owner.workspace_root: + return f.owner.workspace_root + "/" + f.short_path if ctx.workspace_name: return ctx.workspace_name + "/" + f.short_path else: