Fix output folder for absolute path inputs#296
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes output path generation so that using -o <dir> with absolute input header paths places generated .d files under the requested output directory instead of attempting to write next to the input headers (often unwritable system locations).
Changes:
- Add
findBasePathhelper to compute a common base directory for absolute inputs. - Update multi-input output mapping to build outputs under
config.outputusingrelativePath(file, basePath).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dstep/driver/Util.d | Adds findBasePath to derive a base directory from absolute input paths. |
| dstep/driver/Application.d | Uses findBasePath + relativePath when building output paths for multiple inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
jacob-carlborg
left a comment
There was a problem hiding this comment.
There are no new tests added that shows the change is working.
Currently this fails: ``` $ dstep -o /tmp /usr/include/stdio.h /usr/include/stdlib.h dstep: an unknown error occurred: std.file.FileException@std/file.d(840): /usr/include/stdio.d: Permission denied ``` This is because it tries to create .d files in same directory as input file without respecting output folder. This commit fixes this issue so that it will correctly use output folder for such case.
|
I rewrote this PR and added tests. Implement support for Windows aswell and tested that it works correctly. |
Currently if you use absolute path for input files then output folder is not respected.
That is, this fails:
It tries to create
.dfiles in same directory as input file without respecting output folder.This PR fixes that so that it will correctly use output folder for such case.