MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / resolveInputPath

Function resolveInputPath

javascript/selenium-webdriver/generate_bidi.mjs:128–138  ·  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

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

Callers 3

parseCddlFunction · 0.85
readJsonFunction · 0.85
loadEnhancementsFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected