This line was added to where we initialize sessions:
.and_then(|uri| uri.to_file_path().ok())
This line was removed from SliceConfig:
if let Ok(root_path) = root.to_file_path() {
They do the same thing: convert a uri to a path
Over-explaining stuff
We use root_uri for a single purpose: taking relative paths and making them absolute, so we can pass them to slicec.
But, we don't actually use a uri for this. We convert the uri to PathBuf before we can actually use it.
Right now, when we initialize Session we store a Url, and SliceConfig will convert it to Pathbuf when it needs it.
This PR changes this, so we perform the conversion immediately (during session initialization).
This means we only convert it once per server (instead of once for each configuration set), and if the user gives us a bogus path, we'll catch it immediately and report it, instead of 'catching' it later (SliceConfig actually just ignores the error).
The only thing that actually changed
This line was added to where we initialize sessions:
.and_then(|uri| uri.to_file_path().ok())
This line was removed fromSliceConfig
:if let Ok(root_path) = root.to_file_path() {
They do the same thing: convert a uri to a pathOver-explaining stuff
We use
root_uri
for a single purpose: taking relative paths and making them absolute, so we can pass them toslicec
. But, we don't actually use auri
for this. We convert theuri
toPathBuf
before we can actually use it.Right now, when we initialize
Session
we store aUrl
, andSliceConfig
will convert it toPathbuf
when it needs it. This PR changes this, so we perform the conversion immediately (during session initialization).This means we only convert it once per server (instead of once for each configuration set), and if the user gives us a bogus path, we'll catch it immediately and report it, instead of 'catching' it later (
SliceConfig
actually just ignores the error).