How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
Thanks Ben, I found a join method in the Path std lib, that looks fine, but Im scratching my head, there is no resolve.
I honestly don't know a lot about Rust but I think you are trying to tell me that PathBuff can do string things. I dont even know if I can split strings and mess with them as a vec.
Yep, that's exactly what I was getting at. You literally just push a Path to a PathBuf and there it is, and now it's been attached as a child directory. No need to resolve anything else.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
Probably, word on the street (StackOverflow) is that there are issues with canonicalize (I should find out more), thanks for the push, I will go check it out.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
I hadn't seen any issues with it in my own usage, but there's also path_abs, an external crate which solves this problem. So, the existence of the crate says that there probably is something I don't know about! Good luck.
That's an artifact of how rust generally handles errors - all functions return a Result<T, E>. The variants of this type are Ok(T) or Err(E). Functions that don't return a value end up with an Ok(()), signalling success and returning unit. You can only use ? in a fn that returns a Result
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
So it looks like the airquotes problem with canonicalize is that it looks at the real FS. In a cli tool where foo/ is not a dir this would panic (that to me is a real strength!) This is substantially better than node path where it's just a string. Just need catch the error. IL share working code soon.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks Ben, I found a
join
method in the Path std lib, that looks fine, but Im scratching my head, there is no resolve.I honestly don't know a lot about Rust but I think you are trying to tell me that PathBuff can do string things. I dont even know if I can split strings and mess with them as a vec.
Yep, that's exactly what I was getting at. You literally just
push
aPath
to aPathBuf
and there it is, and now it's been attached as a child directory. No need to resolve anything else.String has a
split()
- that should help!Ah, sorry, you're probably specifically looking for canonicalize?
Probably, word on the street (StackOverflow) is that there are issues with canonicalize (I should find out more), thanks for the push, I will go check it out.
also, interesting that this is part of the fs module. As I said before, I am used to node where this would be part of the path module.
Also one last thing, what the heck is Ok(()), I keep seeing this in the docs.
I hadn't seen any issues with it in my own usage, but there's also path_abs, an external crate which solves this problem. So, the existence of the crate says that there probably is something I don't know about! Good luck.
That's an artifact of how rust generally handles errors - all functions return a
Result<T, E>
. The variants of this type areOk(T)
orErr(E)
. Functions that don't return a value end up with anOk(())
, signalling success and returning unit. You can only use?
in a fn that returns aResult
So it looks like the airquotes problem with canonicalize is that it looks at the real FS. In a cli tool where foo/ is not a dir this would panic (that to me is a real strength!) This is substantially better than node path where it's just a string. Just need catch the error. IL share working code soon.