fix: use dunce::canonicalize to strip \\?\ prefix on Windows#185
fix: use dunce::canonicalize to strip \\?\ prefix on Windows#185Jokerkern wants to merge 1 commit intoWhatsApp:mainfrom
Conversation
|
Hi @Jokerkern! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Problem
On Windows,
std::fs::canonicalizereturns paths prefixed with\\?\(e.g.
\\?\E:\project\...). When ELP matches a file opened in VS Codeagainst the app's source root, the comparison fails because VS Code URIs
resolve to plain paths like
E:\project\...— the\\?\prefix causesa mismatch.
This causes every file to fall into the catch-all source root, which has
no app_data. The result is that all rebar3 projects on Windows are broken:
Fix
Replace
fs::canonicalizewithdunce::canonicalizeininto_abs_path.The
duncecrate is a well-known lightweight solution for this exactproblem, stripping the
\\?\prefix on Windows while behavingidentically to
std::fs::canonicalizeon all other platforms.Testing
Verified on Windows 10 with a rebar3 project. All issues above are
resolved after this fix.