Skip to content

Handle doc locations when file is in parent directory#15898

Merged
straight-shoota merged 4 commits intocrystal-lang:masterfrom
Blacksmoke16:chid-base-dirs
Jun 15, 2025
Merged

Handle doc locations when file is in parent directory#15898
straight-shoota merged 4 commits intocrystal-lang:masterfrom
Blacksmoke16:chid-base-dirs

Conversation

@Blacksmoke16
Copy link
Member

Fixes #15888

@Blacksmoke16 Blacksmoke16 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:docs-generator labels Jun 13, 2025
@Blacksmoke16
Copy link
Member Author

Okay, am I missing something as to why these tests are failing on windows? Should to_native not normalize the path I provide to whatever the underlying OS expects?

@straight-shoota
Copy link
Member

straight-shoota commented Jun 13, 2025

Path.[] already constructs a native path. The call to to_native is always a no-op.

But you're explicitly constructing a path with forward slash as separator (Path["src/foo.cr"]). This is entirely valid in Windows, despite backslash being the more idiomatic variant. to_windows conversion does not change forward slash directory separators to backslash.
If you want canonical paths per platform, you should construct the path from individual components: Path["src", "foo.cr"].

EDIT: Or call Path#normalize. This transforms all forward slashs into backslashs on a Windows path.

@straight-shoota straight-shoota added this to the 1.17.0 milestone Jun 13, 2025
@straight-shoota straight-shoota merged commit be7f0af into crystal-lang:master Jun 15, 2025
37 checks passed
@Blacksmoke16 Blacksmoke16 deleted the chid-base-dirs branch July 18, 2025 04:18
Blacksmoke16 added a commit that referenced this pull request Jul 18, 2025
straight-shoota pushed a commit that referenced this pull request Jul 18, 2025
…" (#15996)

Reverts #15898 because it caused a regression bug which is worse then the original problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:docs-generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing location info if passed source files in a parent directory

2 participants