Skip to content

Add Path#relative?#16473

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
Sija:add-path-relative
Dec 9, 2025
Merged

Add Path#relative?#16473
straight-shoota merged 1 commit intocrystal-lang:masterfrom
Sija:add-path-relative

Conversation

@Sija
Copy link
Contributor

@Sija Sija commented Dec 3, 2025

Akin to URI#relative?, opposite of Path#absolute?.

@HertzDevil
Copy link
Contributor

Windows has drive-relative, root-relative, and pure relative paths, so "absolute" and "relative" are not a dichotomy for Path. Thus I think this method would only bring more confusion.

@Sija
Copy link
Contributor Author

Sija commented Dec 3, 2025

IIUC Windows is an outlier here, on any other system this distinction is pretty clear... 🤷‍♂️

@straight-shoota
Copy link
Member

straight-shoota commented Dec 3, 2025

IMO the term "relative" is unambiguous. It refers to on-absolute paths on both POSIX and Windows. Drive-relative and root-relative paths on Windows are explicitly called relative, so it makes sense that they're subsumed in Path#relative?, alongside CWD-relative paths.
I would not expect this to cause confusion.

@straight-shoota straight-shoota added this to the 1.19.0 milestone Dec 8, 2025
@straight-shoota straight-shoota merged commit e1c2168 into crystal-lang:master Dec 9, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants