improve portability of window path/uri check for osc 7

This commit is contained in:
Wez Furlong committed 2020-02-09 13:16:08 -08:00
1 parent 65707aba56
commit 79d8342a9d
1 file changed
+2 -1
+2 -1
View File
@@ -1135,7 +1135,8 @@ impl TermWindow {
// On Windows the file URI can produce a path like:
// `/C:\Users` which is valid in a file URI, but the leading slash
// is not liked by the windows file APIs, so we strip it off here.
if cfg!(windows) && path.starts_with('/') {
let bytes = path.as_bytes();
if bytes.len() > 2 && bytes[0] == b'/' && bytes[2] == b':' {
Some(path[1..].to_owned())
} else {
Some(path)