Repository navigation
Return relative paths with forward slashes on Windows - #88
Merged
Merged
Conversation
Relative paths are written into generated files, where the backslashes of a Windows path are escape characters. Absolute paths remain native.
Makes the build log independent of the host. Build logs with native paths written by previous versions are still read correctly.
salkinium
force-pushed
the
feature/posix-paths
branch
from
October 12, 2026 10:36
3a85047 to
93e6523
Compare
14 tasks done
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.
On Windows lbuild hands modules relative paths with backslashes, which then land in generated SConstruct/CMake/Python files as lovely escape sequences:
generated\nanopbhas a newline in it andgenerated\xpccis a syntax error, lol. modm currently works around this with acommon_posix()helper in about a dozen places (modm-io/modm#1389), but this really should be fixed at the source.So relative paths now use
/on every host. Absolute paths stay native, since modules use them for file system access. Nothing changes on Linux and macOS.env.relcwdoutpath(),env.relative_outpath()andenv.generated_local_files()return forward slashes.BuildLogOperation.filenametoo, which also covers the collector scopefilenameand theoperation_metadatakeys.PathOptionandPathCollectorvalues too, so..\..\buildin aproject.xmlcomes back as../../build. Absolute values are left alone.lbuild cleanworks in both directions.ntpathon every host, so they actually test something on Linux.common_posix()disabled: Nanopb, XPCC, CMake and CompilationDB examples fail to build with 1.22.0 and build with this.Heads-up for other repositories: if a module splits these paths on
os.sepor compares them withos.path.join()output, that breaks on Windows now.Missing: Not tested on a real Windows, only in Wine. The test suite also only runs on Linux in CI, a few of the older tests are not Windows-clean anyways.