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,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
|
||||
|
Loading…
Reference in New Issue
Block a user