Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for Path::relative_from stabilization #23284
Comments
brson
added
the
I-nominated
label
Mar 11, 2015
This comment has been minimized.
This comment has been minimized.
|
cc #23283 |
This comment has been minimized.
This comment has been minimized.
|
cc me |
This comment has been minimized.
This comment has been minimized.
|
Note that the reason the new semantics was adopted has to do with symlinks (the same reason we do not normalize |
This comment has been minimized.
This comment has been minimized.
|
Function is not yet stable, so this need not be milestoned. P-high, not 1.0. |
pnkfelix
added
P-medium
and removed
I-nominated
labels
Mar 19, 2015
This comment has been minimized.
This comment has been minimized.
|
It's still a potentially useful operation, but because of symlinks, there are two different behaviors that might be desired:
Based on that I think it's reasonable to provide both implementations. The former might want to be called something like |
aturon
changed the title
New Path::relative_from is less useful than old Path::path_relative_from
Tracking issue for Path::relative_from stabilization
Aug 12, 2015
aturon
added
T-libs
B-unstable
labels
Aug 12, 2015
This comment has been minimized.
This comment has been minimized.
Just noting that I have found this function useful. I think it would probably make more sense to name it something like |
This comment has been minimized.
This comment has been minimized.
|
I too have found this function useful. What has to happen to stabilize this? |
This comment has been minimized.
This comment has been minimized.
|
This should be stabilized or a similar function should be proposed. |
This comment has been minimized.
This comment has been minimized.
|
since @mbrubeck pointed me here for my usecase too, here it comes: let path = Path::new("/might/be/something/a");
assert_eq!(path.relative_from(Path::new("/might/be")), Path::new("something/a"));I'm more than fine on renaming it to |
This comment has been minimized.
This comment has been minimized.
|
re: timing, after the 1.6 beta is cut (next week) we will triage all unstable APIs and select a batch for 1.7 stabilization. I'll make sure this one is up for discussion. |
sfackler
added
the
I-nominated
label
Dec 16, 2015
This comment has been minimized.
This comment has been minimized.
|
Maybe it could be |
This comment has been minimized.
This comment has been minimized.
|
The libs team likes the name |
alexcrichton
added
final-comment-period
and removed
I-nominated
labels
Dec 17, 2015
This comment has been minimized.
This comment has been minimized.
|
str's |
This comment has been minimized.
This comment has been minimized.
|
Just pointing out that Windows treats |
This comment has been minimized.
This comment has been minimized.
|
let path = Path::new("/home/user/code");
let home = env::home_dir().unwrap();
path.relative_from(home);
path.strip_prefix(home);
path.trim(home); |
This comment has been minimized.
This comment has been minimized.
|
I wonder if this should return |
This comment has been minimized.
This comment has been minimized.
|
+1 to explicit error |
This comment has been minimized.
This comment has been minimized.
|
What would be the variants of |
This comment has been minimized.
This comment has been minimized.
|
I was thinking |
This comment has been minimized.
This comment has been minimized.
|
I like |
This comment has been minimized.
This comment has been minimized.
|
I'm on board with both the renaming and using |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this during triage yesterday and the decision was to stabilize with the name |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 15, 2016
alexcrichton
referenced this issue
Jan 15, 2016
Merged
std: Stabilize APIs for the 1.7 release #30943
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 15, 2016
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 15, 2016
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 16, 2016
bors
added a commit
that referenced
this issue
Jan 16, 2016
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 16, 2016
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 16, 2016
This comment has been minimized.
This comment has been minimized.
softprops
commented
Jan 16, 2016
|
Is strip_prefix a different name for the same behavior found on strings? |
This comment has been minimized.
This comment has been minimized.
|
@softprops |
brson commentedMar 11, 2015
Path::relative_fromremoves the common prefix from a path, e.g./foo/barrelative_from/fooyieldsbar.The old
path_relative_fromwould calculate the relative path from two points on the file system, e.g. the relative path from/foo/barto/foo/baz/quxis../baz/qux. This is a useful operation.Nominating because I think either
relative_fromis named wrong or is not useful.