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:
parent
b124539507
commit
cd49c2103b
@ -190,14 +190,12 @@ 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
Block a user