Repository navigation
Tester/windows path fix - #36
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alone file instead of project file)
devtools::install_local(), pkgdown::build_site() and
devtools::document() interpolated the current directory into a
single-quoted R string. On Windows, R's parser reads backslashes as
escape sequences ('\U' starts a unicode escape), aborting the command
with "'\U' used without hex digits in character string".
Add an r_path() helper that converts backslashes to forward slashes —
valid path separators in R on every platform, Windows included — and
use it at the three call sites. No-op on Unix paths.
Unit tests cover the Windows conversion, the Unix no-op, the '.'
fallback, and the generated R command containing no backslash.
fabriceHategekimana
approved these changes
Oct 19, 2026
fabriceHategekimana
left a comment
Collaborator
There was a problem hiding this comment.
The change is good. It replace the parts needed for windows paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Three commands (
typr pkg install,typr pkgdown,typr document)build an R command as a string and drop the current directory into it.
On Windows that path has backslashes, R reads
\Uas a unicode escape,and the command dies before running. This PR adds a small
r_path()helper that converts backslashes to forward slashes — valid in R on
Windows too — at those three call sites. Unix paths have no
backslashes, so nothing changes there.
Checks
cargo test --workspacepasses locally — with one caveat:format_r::tests::styles_messy_code_when_availablefails, but itfails on a clean checkout too (verified by stashing). It's the
known air formatter version issue, unrelated to this change.
The 4 new tests for
r_path()pass.cargo fmt --allappliedtypr case runshows noREGRESS; not ticked on purpose.My Windows run shows 14 REGRESS, and I dug into every one (full
write-up below). None come from this PR: 8 are my local air
version not formatting output (whitespace-only diffs, verified
identical modulo whitespace), 2 are case bundles that are
internally inconsistent and should fail on CI too (0066/0067),
and 4 are the case runner's
@rungrep tripping on Windows CRLFline endings in R's output. A Linux CI run should be green
except possibly 0066/0067.
If this PR touches the parser or the type checker
It doesn't, only the CLI. Unit tests added instead of a
cases/entry:the bug is in how the CLI shells out to R, not in the language, so a
catalogue case (which replays
check/build/runon.tyfiles)can't exercise it.
Validation on Windows
I installed the dev build and ran the three commands in a real
project.
typr pkg installandtypr documentnow work since the\Uerror is gone.
typr pkgdowngets past the path parsing and failslater for an unrelated reason (Pandoc not installed on my machine as
an environment prerequisite, not this fix).
Testing surfaced three follow-up issues, none caused by this PR,
which I'll file separately:
typr initreported devtools as installed when the project's renv couldn't load it — the check seems to look at the global R library instead of the project library.devtools::install_local()is deprecated (since devtools 2.5.0, pointing topak::pak("local::...")) and now requires theremotespackage, which a fresh renv project doesn't have. The install still completed.typr pkgdownneeds Pandoc on PATH and fails deep inside a callr subprocess when it's missing. An early check with a clear message would be nicer.