Commit a810d1f
committed
Remove TODOs about using
The `to_unix_separators` and `to_windows_separators` functions in
`gix_path::convert` had TODO comments saying they should use the
`path-slash` crate "to handle escapes". These comments were added
as part of e4f4c4b (#397) but the context there and in the broader
related issue #301 does not seem to clarify the basis for this.
It is not really clear what handling escapes would entail here, and
it seems like there is not a way to do it without substantially
changing the interface of these conversion functions in `gix-path`,
which currently take a single argument representing a path and
return a single string-like value also representing a path. If
escape sequences appear in the input to such a path conversion
function, it would not have a way to know if they are meant
literally or as escape sequences. (An analogous concern applies if
a function is to add escape sequences in its return value; it would
have no way to know if the caller expects them.)
Furthermore, while `path-slash` can convert some `\` paths to use
`/` instead, it does not appear to do anything related to handling
escape sequences or distinguishing which occurrences of `\` or any
other character may be intended as part of an escape sequence. Its
documentation (https://docs.rs/path-slash/latest/path_slash/) does
prominently mention that `\` in escape sequences should not be
converted to `/`:
> On Unix-like OS, the path separator is `/`. So any conversion is
> not necessary. But on Windows, the file path separator is `\`,
> and needs to be replaced with `/` for converting the paths to
> "slash paths". Of course, `\`s used for escaping characters
> should not be replaced.
But it looks like the part about `\` characters used for escaping
is meant as advice on how and when to use `path-slash`, rather than
meaning that `path-slash` would itself be able to distinguish
between `\` characters meant as directory separators and `\`
characters that perform quoting/escaping.path-slash to handle escapes1 parent b4fe425 commit a810d1f
1 file changed
+0
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
242 | 241 | | |
243 | | - | |
244 | 242 | | |
245 | 243 | | |
246 | 244 | | |
| |||
0 commit comments