os: fix read_lines for win/dos files on unix
parent
b124539507
commit
cd49c2103b
|
@ -190,13 +190,11 @@ pub fn read_lines(path string) []string {
|
||||||
buf_index = len
|
buf_index = len
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if buf[len - 1] == 10 {
|
if buf[len - 1] == 10 || buf[len - 1] == 13 {
|
||||||
buf[len - 1] = `\0`
|
buf[len - 1] = `\0`
|
||||||
}
|
}
|
||||||
$if windows {
|
if len > 1 && buf[len - 2] == 13 {
|
||||||
if buf[len - 2] == 13 {
|
buf[len - 2] = `\0`
|
||||||
buf[len - 2] = `\0`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
res << tos_clone(buf)
|
res << tos_clone(buf)
|
||||||
buf_index = 0
|
buf_index = 0
|
||||||
|
|
Loading…
Reference in New Issue