================ @@ -1,12 +1,19 @@ function genLink(Ref) { var Path = `${window.location.protocol}//${window.location.host}/${Ref.Path}`; + var isFileProtocol = window.location.protocol.startsWith("file"); + // we treat the file paths different depending on if we're + // serving via a http server or viewing from a local + if (isFileProtocol) { + Path = `${window.location.protocol}//${RootPath}/${Ref.Path}`; + } if (Ref.RefType !== "namespace") { if (Ref.Path === "") { Path = `${Path}${Ref.Name}.html`; - } - else { + } else { Path = `${Path}/${Ref.Name}.html`; } + } else { + Path = `${Path}/index.html` } ---------------- ilovepi wrote:
I'm also wondering if we should reverse the logic here to be slightly easer to follow. ``` if(Ref.RefType === "namespace"){ Path = `${Path}/index.html` } else { //... } ``` It's not really any functional change, though. IIRC in JS the ordering of statements has some performance impact, so I guess the ordering should be determined by which case we think is more common? Then again, you'd hope anything that affects performance would hit the JIT and get optimized nicely, so maybe this whole point is moot in practice. I'll leave the final determination up to you, since you deal w/ JS and website performance more frequently than I do. https://github.com/llvm/llvm-project/pull/93281 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits