1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: fix read_lines for win/dos files on unix

This commit is contained in:
Alvydas Vitkauskas 2019-08-01 01:48:10 +03:00 committed by Alexander Medvednikov
parent b124539507
commit cd49c2103b

View File

@ -190,13 +190,11 @@ pub fn read_lines(path string) []string {
buf_index = len
continue
}
if buf[len - 1] == 10 {
if buf[len - 1] == 10 || buf[len - 1] == 13 {
buf[len - 1] = `\0`
}
$if windows {
if buf[len - 2] == 13 {
buf[len - 2] = `\0`
}
if len > 1 && buf[len - 2] == 13 {
buf[len - 2] = `\0`
}
res << tos_clone(buf)
buf_index = 0