Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove TODOs about using
path-slash
to handle escapes
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 appaer 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 sequencs or distinguishing which occurrences of `\` or any other character may be intended as part of an escape sequence. Its documentation does prominently mention that `\` in escape sequnces 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.
- Loading branch information