MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / resolveInputPath

Function resolveInputPath

javascript/selenium-webdriver/generate_bidi.mjs:129–139  ·  view source on GitHub ↗

* Resolve a path that came from a Bazel $(location …) expansion. * * When a js_binary runs inside a js_run_binary action Bazel sets BAZEL_BINDIR * and the js_binary wrapper calls process.chdir(BAZEL_BINDIR) before handing * control to the script. $(location) values are relative to the *execroot*

(p)

Source from the content-addressed store, hash-verified

127 * Outside Bazel (BAZEL_BINDIR unset) paths are resolved normally.
128 */
129function resolveInputPath(p) {
130 if (!p) return null
131 if (!process.env.BAZEL_BINDIR) return resolve(p)
132 // Normalize both strings to forward slashes before prefix-stripping so that
133 // mixed separators on Windows (BAZEL_BINDIR uses '\', $(location) uses '/')
134 // do not cause the startsWith check to silently fail.
135 const normalizedP = p.replaceAll('\\', '/')
136 const normalizedBindir = process.env.BAZEL_BINDIR.replaceAll('\\', '/')
137 const prefix = normalizedBindir + '/'
138 return resolve(normalizedP.startsWith(prefix) ? normalizedP.slice(prefix.length) : normalizedP)
139}
140
141// ============================================================
142// Main

Callers 4

parseCddlFunction · 0.85
vendorFileStemFunction · 0.85
readJsonFunction · 0.85
loadEnhancementsFunction · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected